Skip to content

Commit

Permalink
Allow FQN with 3 parts (namespace/package/action) to be input with/wi…
Browse files Browse the repository at this point in the history
…thout leading slash in CLI (apache#2424)
  • Loading branch information
underwoodb-sd-ibm authored and csantanapr committed Aug 17, 2017
1 parent bfc0133 commit eea71f2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
1 change: 0 additions & 1 deletion tests/src/test/scala/system/basic/WskActionTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -356,5 +356,4 @@ class WskActionTests
activation.logs.get.mkString(" ") should include(s"hello $utf8")
}
}

}
29 changes: 29 additions & 0 deletions tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit eea71f2

Please sign in to comment.