weizhouapache commented on code in PR #6984:
URL: https://github.com/apache/cloudstack/pull/6984#discussion_r1048263071


##########
plugins/api/rate-limit/src/test/java/org/apache/cloudstack/ratelimit/ApiRateLimitTest.java:
##########
@@ -112,15 +112,24 @@ public void sequentialApiAccess() {
     public void canDoReasonableNumberOfApiAccessPerSecond() throws Exception {
         int allowedRequests = 200;
         s_limitService.setMaxAllowed(allowedRequests);
-        s_limitService.setTimeToLive(1);
+        s_limitService.setTimeToLive(5);
+        long startTime = System.nanoTime();
 
         User key = createFakeUser();
 
         for (int i = 0; i < allowedRequests; i++) {
-            assertTrue("We should allow " + allowedRequests + " requests per 
second, but failed at request " + i, isUnderLimit(key));
+            assertTrue(String.format("We should allow %d requests per second, 
but failed at request %d.", allowedRequests, i), isUnderLimit(key));
         }
-
-        assertFalse("We should block >" + allowedRequests + " requests per 
second", isUnderLimit(key));
+        // we cannot really say more about this test
+        boolean underLimit =  isUnderLimit(key);
+        long endtime = System.nanoTime();

Review Comment:
   ```suggestion
           long endtime = System.nanoTime();
           System.out.println("time elapsed " + (endtime - startTime)/1000/1000 
+ " ms");
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to