markusthoemmes commented on a change in pull request #2795: enable concurrent 
activation processing
URL: 
https://github.com/apache/incubator-openwhisk/pull/2795#discussion_r193305580
 
 

 ##########
 File path: 
tests/src/test/scala/whisk/core/containerpool/test/ContainerProxyTests.scala
 ##########
 @@ -383,6 +387,97 @@ class ContainerProxyTests
     }
   }
 
+  //This tests concurrency from the ContainerPool perspective - where multiple 
Run messages may be sent to ContainerProxy
+  //without waiting for the completion of the previous Run message (signaled 
by NeedWork message)
+  //Multiple messages can only be handled after Warming.
+  it should "stay in Running state if others are still running" in 
within(timeout) {
+    val initPromise = Promise[Interval]()
+    val runPromises = Seq(
+      Promise[(Interval, ActivationResponse)](),
+      Promise[(Interval, ActivationResponse)](),
+      Promise[(Interval, ActivationResponse)](),
+      Promise[(Interval, ActivationResponse)]())
+    val container = new TestContainer(Some(initPromise), Some(runPromises))
+    val factory = createFactory(Future.successful(container))
+    val acker = createAcker()
+    val store = createStore
+    val collector = createCollector()
+
+    val machine =
+      childActorOf(
+        ContainerProxy
+          .props(factory, acker, store, collector, InstanceId(0), poolConfig, 
pauseGrace = timeout))
+    registerCallback(machine)
+    preWarm(machine) //ends in Started state
+
+    machine ! Run(action, message) //first in Started state
+    machine ! Run(action, message) //second in Started or Running state
+
+    //first message go from Started -> Running -> Ready, with 2 NeedWork 
messages (1 for init, 1 for run)
+    //second message will be delayed until we get to Running state with 
WarmedData
+    //   (and will produce 1 NeedWork message after run)
+    expectMsg(Transition(machine, Started, Running))
+
+    //complete the init
+    initPromise complete Try(initInterval)
 
 Review comment:
   Can you not explicitly succeed all the promises by using `success` vs 
`complete`+ `Try`?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to