apovzner commented on a change in pull request #8768:
URL: https://github.com/apache/kafka/pull/8768#discussion_r468175154



##########
File path: core/src/test/scala/unit/kafka/network/ConnectionQuotasTest.scala
##########
@@ -70,37 +80,38 @@ class ConnectionQuotasTest {
         blockedPercentMeters.put(name, KafkaMetricsGroup.newMeter(
           s"${name}BlockedPercent", "blocked time", TimeUnit.NANOSECONDS, 
Map(ListenerMetricTag -> name)))
     }
+    // use system time, because ConnectionQuota causes the current thread to 
wait with timeout, which waits based on
+    // system time; so using mock time will likely result in test flakiness 
due to a mixed use of mock and system time
+    metrics = new Metrics(new MetricConfig(), Collections.emptyList(), 
Time.SYSTEM)

Review comment:
       This is required for all tests. For tests that are not supposed to 
trigger throttling due to connection rate quota, we want this because if the 
code incorrectly throttles to limit rate (calls wait() with timeout), the 
existing tests may start failing in a way that is hard to debug (timeout too 
early or too late, not in a place we expect). 




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to