Skip to content

Commit de196ae

Browse files
authored
KREST-10759 Fix flakyness in test on Jenkins (#1175)
1 parent f5f6ce9 commit de196ae

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

kafka-rest/src/test/java/io/confluent/kafkarest/integration/CustomLogIntegrationTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,13 @@ private void verifyLog(
509509
assertEquals(0, totalRequests);
510510
return;
511511
}
512-
assertEquals(expectedRateLimitLogs, rateLimitedRequests);
512+
// This test will run on CI machines(like on Jenkins), which are shared & busy. Even
513+
// though all requests are expected to be done with-in 1 second, on such machines, they can
514+
// happen across 1 second. So less # of requests are rate-limited, keep 5% margin for that.
515+
int minExpectedRateLimitLogs = (int) (0.95 * expectedRateLimitLogs);
516+
assertTrue(
517+
rateLimitedRequests >= minExpectedRateLimitLogs,
518+
"Expected # of rate-limited requests to be >= " + minExpectedRateLimitLogs);
513519
assertEquals(expectedNumOfEntries, totalRequests);
514520
}
515521
}

0 commit comments

Comments
 (0)