markusthoemmes commented on a change in pull request #3950: Extend system
testsuite
URL:
https://github.com/apache/incubator-openwhisk/pull/3950#discussion_r208861341
##########
File path: tests/src/test/scala/system/basic/WskActionTests.scala
##########
@@ -71,6 +71,49 @@ class WskActionTests extends TestHelpers with
WskTestHelpers with JsHelpers with
}
}
+ it should "invoke an action that throws an uncaught exception and returns
correct status code" in withAssetCleaner(
+ wskprops) { (wp, assetHelper) =>
+ val name = "throwExceptionAction"
+ assetHelper.withCleaner(wsk.action, name) { (action, _) =>
+ action.create(name,
Some(TestUtils.getTestActionFilename("runexception.js")))
+ }
+
+ withActivation(wsk.activation, wsk.action.invoke(name)) { activation =>
+ val response = activation.response
+ activation.response.status shouldBe "action developer error"
+ activation.response.result shouldBe Some(
+ JsObject("error" -> "An error has occurred: Extraordinary
exception".toJson))
+ }
+ }
+
+ it should "invoke an action with option --blocking only and verify output"
in withAssetCleaner(wskprops) {
+ (wp, assetHelper) =>
+ val name = "invokeResult"
+ assetHelper.withCleaner(wsk.action, name) { (action, _) =>
+ action.create(name, Some(TestUtils.getTestActionFilename("echo.js")))
+ }
+ val args = Map("hello" -> "Robert".toJson)
+ val run = wsk.action.invoke(name, args, blocking = true)
+
+ run.stdout.parseJson.asJsObject.getFieldPath("response",
"result").get.asJsObject shouldBe JsObject(args)
+
+ run.stdout.parseJson.asJsObject
+ .getFields(
+ "activationId",
+ "annotations",
+ "duration",
+ "end",
+ "logs",
+ "name",
+ "namespace",
+ "publish",
+ "response",
+ "start",
+ "subject",
+ "version") should have size 12
+
+ }
Review comment:
I think this test should move to the API-level, as it only verifies the
schema of the response vs. doing something that requires to go through the
whole system, is that correct?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services