markusthoemmes commented on a change in pull request #2246: To resolve #2245 - 
optimize container removal
URL: 
https://github.com/apache/incubator-openwhisk/pull/2246#discussion_r116658041
 
 

 ##########
 File path: 
tests/src/test/scala/whisk/core/containerpool/test/ContainerPoolTests.scala
 ##########
 @@ -148,11 +169,43 @@ class ContainerPoolTests extends 
TestKit(ActorSystem("ContainerPool"))
         pool ! runMessage
         containers(0).expectMsg(runMessage)
         containers(0).send(pool, NeedWork(warmedData()))
+        feed.expectMsg(ContainerReleased)
+        pool ! runMessage2
+        containers(0).expectMsg(Remove)
+        containers(1).expectMsg(runMessage2)
+    }
+
+    it should "remove a container to make space in the pool if it is already 
full and another action with different invocation namespace arrives" in 
within(timeout) {
+      val (containers, factory) = testContainers(2)
+      val feed = TestProbe()
+
+      // a pool with only 1 slot
+      val pool = system.actorOf(ContainerPool.props(factory, 1, feed.ref))
+      pool ! runMessage
+      containers(0).expectMsg(runMessage)
+      containers(0).send(pool, NeedWork(warmedData()))
+      feed.expectMsg(ContainerReleased)
+      pool ! runMessage1b
+      containers(0).expectMsg(Remove)
+      containers(1).expectMsg(runMessage1b)
+    }
+
+
+    it should "not remove a container to make space in the pool if it is 
already full and the same action + same invocation namespace arrives" in 
within(timeout) {
 
 Review comment:
   This test is essentially a duplicate of the below, no? I think we shouldn't 
test the internals of `schedule` and `remove` too much in the more general 
`ContainerPoolTests`. Thoughts?
 
----------------------------------------------------------------
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