splett2 commented on a change in pull request #9386:
URL: https://github.com/apache/kafka/pull/9386#discussion_r521566585



##########
File path: core/src/test/scala/unit/kafka/network/ConnectionQuotasTest.scala
##########
@@ -633,18 +837,27 @@ class ConnectionQuotasTest {
                                 listenerName: ListenerName,
                                 address: InetAddress,
                                 numConnections: Long,
-                                timeIntervalMs: Long) : Unit = {
+                                timeIntervalMs: Long,
+                                expectIpThrottle: Boolean): Boolean = {
     var nextSendTime = System.currentTimeMillis + timeIntervalMs
+    var ipThrottled = false
     for (_ <- 0L until numConnections) {
       // this method may block if broker-wide or listener limit on the number 
of connections is reached
-      connectionQuotas.inc(listenerName, address, 
blockedPercentMeters(listenerName.value))
-
+      try {
+        connectionQuotas.inc(listenerName, address, 
blockedPercentMeters(listenerName.value))
+      } catch {
+        case e: ConnectionThrottledException =>
+          if (!expectIpThrottle)
+            throw e
+          ipThrottled = true

Review comment:
       a lot of the tests in `ConnectionQuotasTest` are using system time and 
are looking to reach a connection rate of N/s. so it may be the case that 
`ipThrottled` will remain true, but we want to verify that we can hit a target 
connection rate, even if connections in the middle of the interval get 
throttled.




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