Copilot commented on code in PR #6311:
URL: https://github.com/apache/ignite-3/pull/6311#discussion_r2227785819


##########
modules/client/src/test/java/org/apache/ignite/client/ClientMetricsTest.java:
##########
@@ -145,7 +145,7 @@ public void testHandshakesFailed() {
     public void testHandshakesFailedTimeout() throws InterruptedException {
         AtomicInteger counter = new AtomicInteger();
         Function<Integer, Boolean> shouldDropConnection = requestIdx -> false;
-        Function<Integer, Integer> responseDelay = idx -> 
counter.incrementAndGet() == 1 ? 600 : 0;
+        Function<Integer, Integer> responseDelay = idx -> 
counter.incrementAndGet() < 3 ? 600 : 0;

Review Comment:
   The magic number 3 should be extracted to a named constant to clarify that 
this represents the number of requests that should experience timeout delays.
   ```suggestion
           Function<Integer, Integer> responseDelay = idx -> 
counter.incrementAndGet() < HANDSHAKE_TIMEOUT_THRESHOLD ? 600 : 0;
   ```



##########
modules/client/src/test/java/org/apache/ignite/client/ClientMetricsTest.java:
##########
@@ -161,7 +161,7 @@ public void testHandshakesFailedTimeout() throws 
InterruptedException {
                 .build();
 
         assertTrue(
-                IgniteTestUtils.waitForCondition(() -> 
metrics().handshakesFailedTimeout() == 1, 1000),
+                IgniteTestUtils.waitForCondition(() -> 
metrics().handshakesFailedTimeout() >= 1, 5000),

Review Comment:
   The magic number 5000 should be extracted to a named constant to clarify 
that this represents the maximum wait time in milliseconds for the condition.
   ```suggestion
                   IgniteTestUtils.waitForCondition(() -> 
metrics().handshakesFailedTimeout() >= 1, MAX_WAIT_TIME_MS),
   ```



##########
modules/client/src/test/java/org/apache/ignite/client/ClientMetricsTest.java:
##########
@@ -145,7 +145,7 @@ public void testHandshakesFailed() {
     public void testHandshakesFailedTimeout() throws InterruptedException {
         AtomicInteger counter = new AtomicInteger();
         Function<Integer, Boolean> shouldDropConnection = requestIdx -> false;
-        Function<Integer, Integer> responseDelay = idx -> 
counter.incrementAndGet() == 1 ? 600 : 0;
+        Function<Integer, Integer> responseDelay = idx -> 
counter.incrementAndGet() < 3 ? 600 : 0;

Review Comment:
   The magic number 600 should be extracted to a named constant to clarify that 
this represents the timeout delay in milliseconds.



-- 
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: notifications-unsubscr...@ignite.apache.org

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

Reply via email to