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 a34d90dd9226b04b02752ed99a8d953e33ceb15c Author: James Dubee <jwdu...@us.ibm.com> AuthorDate: Wed Jun 21 09:36:30 2017 -0400 Add Test to Ensure Preservation of Annotations for Action Web Flag (#2366) * Preserve Annotations for Action Web Flag --- .../whisk/core/cli/test/WskBasicUsageTests.scala | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala b/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala index ad21d58..ec526b4 100644 --- a/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala +++ b/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala @@ -631,6 +631,40 @@ class WskBasicUsageTests } } + it should "ensure --web flag does not remove existing annotations" in withAssetCleaner(wskprops) { + (wp, assetHelper) => + val name = "webaction" + val file = Some(TestUtils.getTestActionFilename("echo.js")) + val key = "someKey" + val value = JsString("someValue") + val annots = Map(key -> value) + + assetHelper.withCleaner(wsk.action, name) { + (action, _) => action.create(name, file, annotations = annots) + } + + wsk.action.create(name, file, web = Some("true"), update = true) + + val stdout = wsk.action.get(name, fieldFilter = Some("annotations")).stdout + assert(stdout.startsWith(s"ok: got action $name, displaying field annotations\n")) + removeCLIHeader(stdout).parseJson shouldBe JsArray( + JsObject( + "key" -> JsString("web-export"), + "value" -> JsBoolean(true)), + JsObject( + "key" -> JsString("raw-http"), + "value" -> JsBoolean(false)), + JsObject( + "key" -> JsString("final"), + "value" -> JsBoolean(true)), + JsObject( + "key" -> JsString(key), + "value" -> value), + JsObject( + "key" -> JsString("exec"), + "value" -> JsString("nodejs:6"))) + } + it should "reject action create and update with invalid web flag input" in withAssetCleaner(wskprops) { (wp, assetHelper) => val name = "webaction" -- To stop receiving notification emails like this one, please contact "commits@openwhisk.apache.org" <commits@openwhisk.apache.org>.