markusthoemmes commented on a change in pull request #3656: Adjust the behavior 
when update controller cluster
URL: 
https://github.com/apache/incubator-openwhisk/pull/3656#discussion_r218632221
 
 

 ##########
 File path: tests/src/test/scala/whisk/common/ForcibleSemaphoreTests.scala
 ##########
 @@ -85,4 +85,18 @@ class ForcibleSemaphoreTests extends FlatSpec with Matchers 
{
       acquires should contain theSameElementsAs result
     }
   }
+
+  it should "set the max allowed permits dynamically" in {
+    val s = new ForcibleSemaphore(10)
+    s.tryAcquire(2) shouldBe true // 8 permits left
+
+    s.setMaxPermits(5) // reduce max permits
+    s.availablePermits shouldBe 3
+
+    s.setMaxPermits(10) // increase max permits
+    s.availablePermits shouldBe 8
+
+    s.setMaxPermits(10) // nothing changed
+    s.availablePermits shouldBe 8
 
 Review comment:
   Sounds valid, thanks for catching this!

----------------------------------------------------------------
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