[GitHub] underwoodb-sd-ibm commented on a change in pull request #2424: Allow optional leading slash in CLI commands
underwoodb-sd-ibm commented on a change in pull request #2424: Allow optional leading slash in CLI commands URL: https://github.com/apache/incubator-openwhisk/pull/2424#discussion_r132003908 ## File path: tests/src/test/scala/system/basic/WskBasicTests.scala ## @@ -75,6 +75,34 @@ class WskBasicTests stderr should include(errormsg) } +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}") Review comment: I'm not sure why there is a difference in outputs between invoke and get, but there is one. Invoke prints the FQN, while get only prints the entity name (pkg/action). I suppose it is inconsistent - is this something that should be brought up in a new issue? Or do you think this is something that should have been covered in this PR? 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] underwoodb-sd-ibm commented on a change in pull request #2424: Allow optional leading slash in CLI commands
underwoodb-sd-ibm commented on a change in pull request #2424: Allow optional leading slash in CLI commands URL: https://github.com/apache/incubator-openwhisk/pull/2424#discussion_r131925910 ## File path: tests/src/test/scala/system/basic/WskBasicTests.scala ## @@ -75,6 +75,40 @@ class WskBasicTests stderr should include(errormsg) } +it should "accept a 3 part Fully Qualified Name without a leading '/'" in { +val auth: Seq[String] = Seq("--auth", wskprops.authKey) +val guestNamespace = wskprops.namespace +val packageName = "packageName3ptFQN" +val actionName = "actionName3ptFQN" +val triggerName = "triggerName3ptFQN" +val ruleName = "ruleName3ptFQN" +val fullQualifiedName = s"${guestNamespace}/${packageName}/${actionName}" +val validArgs: Seq[Seq[String]] = Seq( +Seq("package", "create", packageName), +Seq("action", "create", fullQualifiedName, defaultAction.get), +Seq("action", "update", fullQualifiedName, defaultAction.get), +Seq("action", "invoke", fullQualifiedName), +Seq("trigger", "create", triggerName), Review comment: No problem - sorry for the test being confusing. I'll try to rewrite it based on the suggestions here to make it easier to read/understand. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] underwoodb-sd-ibm commented on a change in pull request #2424: Allow optional leading slash in CLI commands
underwoodb-sd-ibm commented on a change in pull request #2424: Allow optional leading slash in CLI commands URL: https://github.com/apache/incubator-openwhisk/pull/2424#discussion_r131748554 ## File path: tests/src/test/scala/system/basic/WskBasicTests.scala ## @@ -75,6 +75,40 @@ class WskBasicTests stderr should include(errormsg) } +it should "accept a 3 part Fully Qualified Name without a leading '/'" in { +val auth: Seq[String] = Seq("--auth", wskprops.authKey) +val guestNamespace = wskprops.namespace +val packageName = "packageName3ptFQN" +val actionName = "actionName3ptFQN" +val triggerName = "triggerName3ptFQN" +val ruleName = "ruleName3ptFQN" +val fullQualifiedName = s"${guestNamespace}/${packageName}/${actionName}" +val validArgs: Seq[Seq[String]] = Seq( +Seq("package", "create", packageName), +Seq("action", "create", fullQualifiedName, defaultAction.get), +Seq("action", "update", fullQualifiedName, defaultAction.get), +Seq("action", "invoke", fullQualifiedName), +Seq("trigger", "create", triggerName), Review comment: We put them in to test that 3 part FQN's could be used during rule creation. A user could enter something like ``` wsk rule create ruleName triggerName namespace/packageName/actionName ``` Is this unnecessary? 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] underwoodb-sd-ibm commented on a change in pull request #2424: Allow optional leading slash in CLI commands
underwoodb-sd-ibm commented on a change in pull request #2424: Allow optional leading slash in CLI commands URL: https://github.com/apache/incubator-openwhisk/pull/2424#discussion_r131748554 ## File path: tests/src/test/scala/system/basic/WskBasicTests.scala ## @@ -75,6 +75,40 @@ class WskBasicTests stderr should include(errormsg) } +it should "accept a 3 part Fully Qualified Name without a leading '/'" in { +val auth: Seq[String] = Seq("--auth", wskprops.authKey) +val guestNamespace = wskprops.namespace +val packageName = "packageName3ptFQN" +val actionName = "actionName3ptFQN" +val triggerName = "triggerName3ptFQN" +val ruleName = "ruleName3ptFQN" +val fullQualifiedName = s"${guestNamespace}/${packageName}/${actionName}" +val validArgs: Seq[Seq[String]] = Seq( +Seq("package", "create", packageName), +Seq("action", "create", fullQualifiedName, defaultAction.get), +Seq("action", "update", fullQualifiedName, defaultAction.get), +Seq("action", "invoke", fullQualifiedName), +Seq("trigger", "create", triggerName), Review comment: We put them in to test that 3 part FQN's could be used during rule creation. A user could enter something like ```wsk rule create ruleName triggerName namespace/packageName/actionName``` Is this unnecessary? 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] underwoodb-sd-ibm commented on a change in pull request #2424: Allow optional leading slash in CLI commands
underwoodb-sd-ibm commented on a change in pull request #2424: Allow optional leading slash in CLI commands URL: https://github.com/apache/incubator-openwhisk/pull/2424#discussion_r131748554 ## File path: tests/src/test/scala/system/basic/WskBasicTests.scala ## @@ -75,6 +75,40 @@ class WskBasicTests stderr should include(errormsg) } +it should "accept a 3 part Fully Qualified Name without a leading '/'" in { +val auth: Seq[String] = Seq("--auth", wskprops.authKey) +val guestNamespace = wskprops.namespace +val packageName = "packageName3ptFQN" +val actionName = "actionName3ptFQN" +val triggerName = "triggerName3ptFQN" +val ruleName = "ruleName3ptFQN" +val fullQualifiedName = s"${guestNamespace}/${packageName}/${actionName}" +val validArgs: Seq[Seq[String]] = Seq( +Seq("package", "create", packageName), +Seq("action", "create", fullQualifiedName, defaultAction.get), +Seq("action", "update", fullQualifiedName, defaultAction.get), +Seq("action", "invoke", fullQualifiedName), +Seq("trigger", "create", triggerName), Review comment: We put them in to test that 3 part FQN's could be used during rule creation. A user could enter something like `wsk rule create ruleName triggerName namespace/packageName/actionName`. Is this unnecessary? 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] underwoodb-sd-ibm commented on a change in pull request #2424: Allow optional leading slash in CLI commands
underwoodb-sd-ibm commented on a change in pull request #2424: Allow optional leading slash in CLI commands URL: https://github.com/apache/incubator-openwhisk/pull/2424#discussion_r131702597 ## File path: tools/cli/go-whisk-cli/commands/util.go ## @@ -41,13 +41,7 @@ import ( "bytes" ) -type QualifiedName struct { -namespace string // namespace. does not include leading '/'. may be "" (i.e. default namespace) -packageName string // package. may be "". does not include leading/trailing '/' -entity string // entity. should not be "" -entityName string // pkg+entity -} - +// TODO: DELETE THIS BLOCK OF CODE ONCE API-EXPERIMENTAL IS REMOVED! Review comment: Sorry - I wasn't sure about the timeline for api-experimental being removed, and so I was trying to be proactive in case there was some chance this might get merged before that specific change. I reverted all api-experimental code back to the way it was before I made changes to it, and a added this code back in so that tests would still run properly in playground/travis. 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: us...@infra.apache.org With regards, Apache Git Services