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/08/17 17:17:47 UTC

[incubator-openwhisk-cli] 06/10: Allow FQN with 3 parts (namespace/package/action) to be input with/without leading slash in CLI (#2424)

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 eea71f2b19c3d6084abb2fe83508616f00dbe669
Author: Brandon Lee Underwood <Br...@ibm.com>
AuthorDate: Thu Aug 10 21:42:13 2017 -0400

    Allow FQN with 3 parts (namespace/package/action) to be input with/without leading slash in CLI (#2424)
---
 .../test/scala/system/basic/WskActionTests.scala   |  1 -
 .../whisk/core/cli/test/WskBasicUsageTests.scala   | 29 ++++++++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/tests/src/test/scala/system/basic/WskActionTests.scala b/tests/src/test/scala/system/basic/WskActionTests.scala
index 0f67ff9..390b342 100644
--- a/tests/src/test/scala/system/basic/WskActionTests.scala
+++ b/tests/src/test/scala/system/basic/WskActionTests.scala
@@ -356,5 +356,4 @@ class WskActionTests
                     activation.logs.get.mkString(" ") should include(s"hello $utf8")
             }
     }
-
 }
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 fb25e54..4d09219 100644
--- a/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
+++ b/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
@@ -92,6 +92,35 @@ class WskBasicUsageTests
         result.stderr should include regex ("""(?i)Run 'wsk --help' for usage""")
     }
 
+    it should "allow a 3 part Fully Qualified Name (FQN) without a leading '/'" in withAssetCleaner(wskprops) {
+        (wp, assetHelper) =>
+            val guestNamespace = wsk.namespace.whois()
+            val packageName = "packageName3ptFQN"
+            val actionName = "actionName3ptFQN"
+            val triggerName = "triggerName3ptFQN"
+            val ruleName = "ruleName3ptFQN"
+            val fullQualifiedName = s"${guestNamespace}/${packageName}/${actionName}"
+            // Used for action and rule creation below
+            assetHelper.withCleaner(wsk.pkg, packageName) {
+                (pkg, _) => pkg.create(packageName)
+            }
+            assetHelper.withCleaner(wsk.trigger, triggerName) {
+                (trigger, _) => trigger.create(triggerName)
+            }
+            // Test action and rule creation where action name is 3 part FQN w/out leading slash
+            assetHelper.withCleaner(wsk.action, fullQualifiedName) {
+                (action, _) => action.create(fullQualifiedName, defaultAction)
+            }
+            assetHelper.withCleaner(wsk.rule, ruleName) {
+                (rule, _) =>
+                    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}")
+    }
+
+
     behavior of "Wsk actions"
 
     it should "reject creating entities with invalid names" in withAssetCleaner(wskprops) {

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