This is an automated email from the ASF dual-hosted git repository.

jojochuang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 52fa36e9ab5 HDDS-16934. Fix intermittent failure in 
TestSCMNodeManager#testDatanodeFinalizedCounterExcludesNonHealthyNodes (#11482)
52fa36e9ab5 is described below

commit 52fa36e9ab55dc3fae0399907803b52da15494c1
Author: Siyao Meng <[email protected]>
AuthorDate: Mon Oct 12 08:54:21 2026 -0700

    HDDS-16934. Fix intermittent failure in 
TestSCMNodeManager#testDatanodeFinalizedCounterExcludesNonHealthyNodes (#11482)
    
    Generated-by: Claude Opus 5.5 <[email protected]>
---
 .../org/apache/hadoop/hdds/scm/node/TestSCMNodeManager.java | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeManager.java
 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeManager.java
index 0a5e414709b..0a8206b2bad 100644
--- 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeManager.java
+++ 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeManager.java
@@ -1000,7 +1000,7 @@ public void 
testDatanodeFencingOnRegister(ComponentVersion scmApparent, Datanode
   @ParameterizedTest
   @MethodSource("ineligibleHealthStates")
   public void testDatanodeFinalizedCounterExcludesNonHealthyNodes(NodeStatus 
expectedStatus)
-      throws IOException, AuthenticationException, NodeNotFoundException, 
InterruptedException {
+      throws IOException, AuthenticationException, NodeNotFoundException, 
InterruptedException, TimeoutException {
     OzoneConfiguration conf = getConf();
     conf.setTimeDuration(OZONE_SCM_HEARTBEAT_PROCESS_INTERVAL, 100, 
MILLISECONDS);
     conf.setTimeDuration(HDDS_HEARTBEAT_INTERVAL, 1, SECONDS);
@@ -1022,15 +1022,10 @@ public void 
testDatanodeFinalizedCounterExcludesNonHealthyNodes(NodeStatus expec
           "Both nodes should start as healthy");
 
       // Only heartbeat the baseline node until transitionNode reaches the 
expected state.
-      // STALE requires > 3s (wait 4s), DEAD requires > 6s (wait 7s total).
-      boolean waitForDead = expectedStatus.equals(NodeStatus.inServiceDead());
-      Thread.sleep(2000);
-      nodeManager.processHeartbeat(heartbeatingNode);
-      Thread.sleep(2000);
-      if (waitForDead) {
+      GenericTestUtils.waitFor(() -> {
         nodeManager.processHeartbeat(heartbeatingNode);
-        Thread.sleep(3000);
-      }
+        return nodeManager.getNodeCount(expectedStatus) == 1;
+      }, 100, WAIT_FOR_TIMEOUT_MS);
 
       assertEquals(expectedStatus, nodeManager.getNodeStatus(transitionNode),
           "Node should have transitioned to " + expectedStatus);


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

Reply via email to