Copilot commented on code in PR #10704:
URL: https://github.com/apache/ozone/pull/10704#discussion_r3555597292


##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeManager.java:
##########
@@ -229,8 +229,8 @@ public void testScmHeartbeat()
         nodeManager.processHeartbeat(datanodeDetails);
       }
 
-      //TODO: wait for heartbeat to be processed
-      Thread.sleep(4 * 1000);
+      GenericTestUtils.waitFor(
+          () -> nodeManager.getAllNodes().size() == registeredNodes, 100, 
4000);
       assertEquals(nodeManager.getAllNodes().size(), registeredNodes,
           "Heartbeat thread should have picked up the scheduled heartbeats.");

Review Comment:
   The `assertEquals` arguments are reversed (actual is passed as the expected 
value). While equality is symmetric, JUnit’s failure output becomes misleading 
and makes debugging harder. Swap the parameters so the expected value is the 
constant `registeredNodes` and the actual is `nodeManager.getAllNodes().size()`.



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