maedhroz commented on code in PR #3655:
URL: https://github.com/apache/cassandra/pull/3655#discussion_r1905897633


##########
test/unit/org/apache/cassandra/transport/ClientResourceLimitsTest.java:
##########
@@ -137,6 +143,23 @@ private SimpleClient client(boolean throwOnOverload, int 
largeMessageThreshold)
         }
     }
 
+    private void emulateInFlightConcurrentMessage(long length)
+    {
+        ClientResourceLimits.Allocator allocator = 
ClientResourceLimits.getAllocatorForEndpoint(FBUtilities.getJustLocalAddress());
+        ClientResourceLimits.ResourceProvider resourceProvider = new 
ClientResourceLimits.ResourceProvider.Default(allocator);
+        resourceProvider.globalLimit().allocate(length);
+        resourceProvider.endpointLimit().allocate(length);
+        emulatedUsedCapacity += length;
+    }
+
+    private void releaseEmulatedCapacity(long length)
+    {
+        ClientResourceLimits.Allocator allocator = 
ClientResourceLimits.getAllocatorForEndpoint(FBUtilities.getJustLocalAddress());
+        ClientResourceLimits.ResourceProvider resourceProvider = new 
ClientResourceLimits.ResourceProvider.Default(allocator);
+        resourceProvider.globalLimit().release(length);
+        resourceProvider.endpointLimit().release(length);
+    }

Review Comment:
   nit: Noting that this is duplicated in `RateLimitingTest`. Might be 
something we could move to a shared abstract class, along with query options 
and client creation, but not a big deal if you don't think it's worth it. 
`MessageSizeLimitTest` and `AuthMessageSizeLimitTest` share some logic as well. 
Perhaps `abstract MessageLimitTest` or `abstract NativeProtocolLimitTest`?



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to