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


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

Review Comment:
   In testScmHeartbeat, the new wait condition uses 
nodeManager.getAllNodes().size(), but nodes are added during register(), so 
this condition is likely true immediately and no longer waits for the 
heartbeat-processing thread to apply the queued heartbeats. This can make the 
test pass even if heartbeat processing is broken. Use a condition that depends 
on heartbeat processing (eg in-service healthy count) to preserve the test's 
intent.



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