You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/06/21 17:37:39 UTC
[GitHub] tysonnorris commented on a change in pull request #41: remove use
of state in nodejs app
tysonnorris commented on a change in pull request #41: remove use of state in nodejs app
URL: https://github.com/apache/incubator-openwhisk-runtime-nodejs/pull/41#discussion_r197218966
##########
File path: tests/src/test/scala/runtime/actionContainers/NodeJsActionContainerTests.scala
##########
@@ -547,4 +547,42 @@ abstract class NodeJsActionContainerTests extends BasicActionRunnerTests with Ws
e shouldBe empty
})
}
+
+ it should "allow running activations concurrently" in {
+ val (out, err) = withNodeJsContainer { c =>
+ //this action will create a log entry, and only complete once all 3 activations have arrived and emitted logs
+ val code =
+ s"""
+ | function main(args) {
+ | console.log("interleave me");
+ | return new Promise(function(resolve, reject) {
+ | setTimeout(function() {
+ | resolve({ args: args});
+ | }, 10000);
+ | });
+ | }
+ """.stripMargin
+
+ c.init(initPayload(code))._1 should be(200)
+
+ val payloads = Seq(JsObject("arg1" -> JsString("value1")), JsObject("arg2" -> JsString("value2")))
+
+ val responses = c.runMultiple(payloads.map {
+ runPayload(_)
+ })
+ payloads.foreach { a =>
+ //responses should contain(200, Some(JsObject("args" -> a)))
+ }
+ }
+
+ checkStreams(out, err, {
+ case (o, e) =>
+ o.replaceAll("\n", "") shouldBe "interleave meinterleave me"
Review comment:
Ok, added some use of global variable - between this and log output, it verifies concurrency. Let me know if it isn't clear?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services