You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by cs...@apache.org on 2017/06/26 15:59:55 UTC

[incubator-openwhisk-cli] 15/36: Handle Application Errors Properly.

This is an automated email from the ASF dual-hosted git repository.

csantanapr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-cli.git

commit e7cdebf83be6b7b7fa629c41772c134d517a1fae
Author: dubeejw <jw...@us.ibm.com>
AuthorDate: Sat Mar 18 16:48:28 2017 -0400

    Handle Application Errors Properly.
    
    - Display application errors for blocking invocations that use the --result flag
---
 tests/src/test/scala/system/basic/WskBasicTests.scala | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/tests/src/test/scala/system/basic/WskBasicTests.scala b/tests/src/test/scala/system/basic/WskBasicTests.scala
index 6d81100..88dfc97 100644
--- a/tests/src/test/scala/system/basic/WskBasicTests.scala
+++ b/tests/src/test/scala/system/basic/WskBasicTests.scala
@@ -326,12 +326,21 @@ class WskBasicTests
     it should "create and invoke a blocking action resulting in an application error response" in withAssetCleaner(wskprops) {
         (wp, assetHelper) =>
             val name = "applicationError"
+            val strErrInput = Map("error" -> "Error message".toJson)
+            val numErrInput = Map("error" -> 502.toJson)
+            val boolErrInput = Map("error" -> true.toJson)
+
             assetHelper.withCleaner(wsk.action, name) {
-                (action, _) => action.create(name, Some(TestUtils.getTestActionFilename("applicationError.js")))
+                (action, _) => action.create(name, Some(TestUtils.getTestActionFilename("echo.js")))
             }
 
-            wsk.action.invoke(name, blocking = true, expectedExitCode = 246)
-                .stderr should include regex (""""error": "This error thrown on purpose by the action."""")
+            Seq(strErrInput, numErrInput, boolErrInput) foreach { input =>
+                getJSONFromCLIResponse(wsk.action.invoke(name, parameters = input, blocking = true, expectedExitCode = 246).stderr).
+                    fields("response").asJsObject.fields("result").asJsObject shouldBe input.toJson.asJsObject
+
+                wsk.action.invoke(name, parameters = input, blocking = true, result = true, expectedExitCode = 246).
+                    stderr.parseJson.asJsObject shouldBe input.toJson.asJsObject
+            }
     }
 
     it should "create and invoke a blocking action resulting in an failed promise" in withAssetCleaner(wskprops) {

-- 
To stop receiving notification emails like this one, please contact
"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>.