Skip to content
Snippets Groups Projects
Commit 13c3d633 authored by Dominik Jall's avatar Dominik Jall Committed by Markus Thoemmes
Browse files

pass unique trigger name in test

parent 4d7153d4
No related branches found
No related tags found
No related merge requests found
......@@ -224,6 +224,7 @@ class WskBasicNodeTests
// this action supplies a 'next' callback to whisk.trigger()
val nameOfActionThatTriggers = "triggerAction"
val actionThatTriggers = Some(TestUtils.getTestActionFilename("triggerCallback.js"))
val triggerName = "UnitTestTrigger-" + System.currentTimeMillis()
assetHelper.withCleaner(wsk.action, nameOfActionThatTriggers) {
(action, _) =>
......@@ -231,22 +232,20 @@ class WskBasicNodeTests
}
// this is expected to fail this time because we have not yet created the trigger
val runReject = wsk.action.invoke(nameOfActionThatTriggers)
val runReject = wsk.action.invoke(nameOfActionThatTriggers, Map("triggerName" -> triggerName.toJson))
withActivation(wsk.activation, runReject) {
activation =>
activation.response.success shouldBe false
activation.response.result.get.fields.get("error") shouldBe defined
}
val triggerName = "UnitTestTrigger"
assetHelper.withCleaner(wsk.trigger, triggerName) {
(trigger, _) =>
trigger.create(triggerName)
}
// now that we've created the trigger, running the action should succeed
val runResolve = wsk.action.invoke(nameOfActionThatTriggers)
val runResolve = wsk.action.invoke(nameOfActionThatTriggers, Map("triggerName" -> triggerName.toJson))
withActivation(wsk.activation, runResolve) {
activation =>
activation.response.success shouldBe true
......@@ -260,6 +259,7 @@ class WskBasicNodeTests
// this action supplies a 'next' callback to whisk.trigger()
val nameOfActionThatTriggers = "triggerAction"
val actionThatTriggers = Some(TestUtils.getTestActionFilename("triggerPromise.js"))
val triggerName = "UnitTestTrigger-" + System.currentTimeMillis()
assetHelper.withCleaner(wsk.action, nameOfActionThatTriggers) {
(action, _) =>
......@@ -267,22 +267,20 @@ class WskBasicNodeTests
}
// this is expected to fail this time because we have not yet created the trigger
val runReject = wsk.action.invoke(nameOfActionThatTriggers)
val runReject = wsk.action.invoke(nameOfActionThatTriggers, Map("triggerName" -> triggerName.toJson))
withActivation(wsk.activation, runReject) {
activation =>
activation.response.success shouldBe false
activation.response.result.get.fields.get("error") shouldBe defined
}
val triggerName = "UnitTestTrigger"
assetHelper.withCleaner(wsk.trigger, triggerName) {
(trigger, _) =>
trigger.create(triggerName)
}
// now that we've created the trigger, running the action should succeed
val runResolve = wsk.action.invoke(nameOfActionThatTriggers)
val runResolve = wsk.action.invoke(nameOfActionThatTriggers, Map("triggerName" -> triggerName.toJson))
withActivation(wsk.activation, runResolve) {
activation =>
activation.response.success shouldBe true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment