yandrey321 commented on code in PR #10837:
URL: https://github.com/apache/ozone/pull/10837#discussion_r3749835088


##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeManager.java:
##########
@@ -822,23 +815,21 @@ public void testScmDetectStaleAndDeadNode()
           nodeCounts.get(HddsProtos.NodeOperationalState.IN_SERVICE.name())
               .get(HddsProtos.NodeState.STALE.name()).intValue());
 
-      Thread.sleep(1000);
-      // heartbeat good nodes again.
-      for (DatanodeDetails dn : nodeList) {
-        nodeManager.processHeartbeat(dn);
-      }
-
-      //  6 seconds is the dead window for this test , so we wait a total of
-      // 7 seconds to make sure that the node moves into dead state.
-      Thread.sleep(2 * 1000);
+      // Keep the good nodes alive until the stale node moves into dead state.
+      GenericTestUtils.waitFor(() -> {
+        for (DatanodeDetails dn : nodeList) {
+          nodeManager.processHeartbeat(dn);
+        }
+        return nodeManager.getNodeCount(NodeStatus.inServiceDead()) == 1;
+      }, interval, 10 * 1000);

Review Comment:
   nit: use the same named constant as above.



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