You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2017/12/13 16:15:36 UTC

[GitHub] houshengbo commented on a change in pull request #2996: Rewrite WskBasicUsageTests

houshengbo commented on a change in pull request #2996: Rewrite WskBasicUsageTests
URL: https://github.com/apache/incubator-openwhisk/pull/2996#discussion_r156705707
 
 

 ##########
 File path: tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
 ##########
 @@ -112,60 +86,17 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers {
         rule.create(ruleName, trigger = triggerName, action = fullQualifiedName)
       }
 
-      wsk.action.invoke(fullQualifiedName).stdout should include(s"ok: invoked /$fullQualifiedName")
-      wsk.action.get(fullQualifiedName).stdout should include(s"ok: got action ${packageName}/${actionName}")
-  }
-
-  it should "include CLI user agent headers with outbound requests" in {
-    val stdout = wsk.cli(Seq("list", "--auth", wskprops.authKey) ++ wskprops.overrides, verbose = true).stdout
-    stdout should include regex (usrAgentHeaderRegEx)
+      val run = wsk.action.invoke(fullQualifiedName)
+      withActivation(wsk.activation, run) { activation =>
+        activation.response.status shouldBe "success"
+      }
+      val action = wsk.action.get(fullQualifiedName)
+      action.getField("name") shouldBe actionName
+      action.getField("namespace") shouldBe s"${guestNamespace}/${packageName}"
   }
 
   behavior of "Wsk actions"
 
-  it should "reject creating entities with invalid names" in withAssetCleaner(wskprops) { (wp, assetHelper) =>
-    val names = Seq(
-      ("", ERROR_EXIT),
-      (" ", BAD_REQUEST),
-      ("hi+there", BAD_REQUEST),
-      ("$hola", BAD_REQUEST),
-      ("dora?", BAD_REQUEST),
-      ("|dora|dora?", BAD_REQUEST))
-
-    names foreach {
-      case (name, ec) =>
-        assetHelper.withCleaner(wsk.action, name, confirmDelete = false) { (action, _) =>
-          action.create(name, defaultAction, expectedExitCode = ec)
-        }
-    }
-  }
-
-  it should "reject create with missing file" in {
-    val name = "notfound"
-    wsk.action.create("missingFile", Some(name), expectedExitCode = MISUSE_EXIT).stderr should include(
-      s"File '$name' is not a valid file or it does not exist")
-  }
-
-  it should "reject action update when specified file is missing" in withAssetCleaner(wskprops) { (wp, assetHelper) =>
-    // Create dummy action to update
-    val name = "updateMissingFile"
-    val file = Some(TestUtils.getTestActionFilename("hello.js"))
-    assetHelper.withCleaner(wsk.action, name) { (action, name) =>
-      action.create(name, file)
-    }
-    // Update it with a missing file
-    wsk.action.create(name, Some("notfound"), update = true, expectedExitCode = MISUSE_EXIT)
-  }
-
-  it should "reject action update for sequence with no components" in withAssetCleaner(wskprops) { (wp, assetHelper) =>
 
 Review comment:
   This one is CLI specific, because it updates an action into sequence without components, MISUSE_EXIT is the CLI exit code, which has no http code as a counterpart. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services