markusthoemmes commented on a change in pull request #2533: Add the ability to 
define user-specific throttles.
URL: 
https://github.com/apache/incubator-openwhisk/pull/2533#discussion_r129859133
 
 

 ##########
 File path: tests/src/test/scala/limits/ThrottleTests.scala
 ##########
 @@ -278,3 +280,89 @@ class ThrottleTests
             waitForActivations(combinedResults.par)
     }
 }
+
+@RunWith(classOf[JUnitRunner])
+class NamespaceSpecificThrottleTests
+    extends FlatSpec
+    with TestHelpers
+    with WskTestHelpers
+    with Matchers
+    with BeforeAndAfterAll {
+
+    val wskadmin = new RunWskAdminCmd {}
+    val wsk = new Wsk
+
+    val defaultAction = Some(TestUtils.getTestActionFilename("hello.js"))
+
+    // Create a subject with rate limits == 0
+    val zeroProps = getAdditionalTestSubject("zeroSubject")
+    wskadmin.cli(Seq("limits", "set", zeroProps.namespace, 
"--invocationsPerMinute", "0", "--firesPerMinute", "0", 
"--concurrentInvocations", "0"))
+
+    // Create a subject where only the concurrency limit is set to 0
+    val zeroConcProps = getAdditionalTestSubject("zeroConcSubject")
+    wskadmin.cli(Seq("limits", "set", zeroConcProps.namespace, 
"--concurrentInvocations", "0"))
+
+    // Create a subject where the rate limits are set to 1
+    val oneProps = getAdditionalTestSubject("oneSubject")
+    wskadmin.cli(Seq("limits", "set", oneProps.namespace, 
"--invocationsPerMinute", "1", "--firesPerMinute", "1"))
+
+    override def afterAll() = {
+        disposeAdditionalTestSubject(zeroProps.namespace)
+        disposeAdditionalTestSubject(zeroConcProps.namespace)
+        disposeAdditionalTestSubject(oneProps.namespace)
+    }
+
+    behavior of "Namespace-specific throttles"
+
+    it should "respect overridden rate-throttles of 0" in 
withAssetCleaner(zeroProps) {
+        (wp, assetHelper) =>
+            implicit val props = wp
 
 Review comment:
   I opted for these very minimal integration tests, because most of the work 
is threading values through the system. They caught lots of tiny bugs while 
developing so I figured it might be worth keeping them.
 
----------------------------------------------------------------
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