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

 ##########
 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:
   does it make sense to make these just unit tests against a entitlement 
provider vs integration tests?
 
----------------------------------------------------------------
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