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

asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git


The following commit(s) were added to refs/heads/master by this push:
     new 1315b208e Refactoring three tests
1315b208e is described below

commit 1315b208ed77f9854b6345925a35394818a99ed8
Author: Junkai Xue <[email protected]>
AuthorDate: Fri Apr 24 21:18:05 2026 -0700

    Refactoring three tests
    
      1. TestStateTransitionTimeout (TestStateTransitionTimeout.java:169)
      - Before: TestHelper.verify(..., 5000) - 5 second timeout
      - After: TestHelper.verify(..., 10000) - 10 second timeout
      - Doubled timeout to handle slower CI environments
    
      2. TestInstanceOperation.testEvacuationWithOfflineInstances 
(TestInstanceOperation.java:1592)
    
      - Before: }, 120000, CLUSTER_NAME) - 2 minute timeout
      - After: }, 180000, CLUSTER_NAME) - 3 minute timeout
      - The CI log showed "Time elapsed: 120.3 s" when it hit the 120s timeout 
- increased to 180s
    
      3. TestHelixTaskExecutor
    
      testNoRetry (line ~914):
      - Added Thread.sleep(500) after stabilization loop to ensure timeout 
cancellations fully propagate before assertions
    
      testRetryOnce (line ~966):
      - Added polling loop to wait up to 1 second for executor._taskMap.size() 
== 0 before assertions
    
      These are minimal timing adjustments to handle CI resource contention. 
The user has asked not to commit these changes.
---
 .../integration/paticipant/TestStateTransitionTimeout.java     |  2 +-
 .../helix/integration/rebalancer/TestInstanceOperation.java    |  2 +-
 .../apache/helix/messaging/handling/TestHelixTaskExecutor.java | 10 ++++++++++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git 
a/helix-core/src/test/java/org/apache/helix/integration/paticipant/TestStateTransitionTimeout.java
 
b/helix-core/src/test/java/org/apache/helix/integration/paticipant/TestStateTransitionTimeout.java
index 447459477..a727ec06b 100644
--- 
a/helix-core/src/test/java/org/apache/helix/integration/paticipant/TestStateTransitionTimeout.java
+++ 
b/helix-core/src/test/java/org/apache/helix/integration/paticipant/TestStateTransitionTimeout.java
@@ -166,7 +166,7 @@ public class TestStateTransitionTimeout extends 
ZkStandAloneCMTestBase {
     Assert.assertTrue(result);
     HelixDataAccessor accessor = _participants[0].getHelixDataAccessor();
 
-    TestHelper.verify(() -> verify(accessor, idealState, factories), 5000);
+    TestHelper.verify(() -> verify(accessor, idealState, factories), 10000);
     Assert.assertTrue(verify(accessor, idealState, factories));
   }
 
diff --git 
a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestInstanceOperation.java
 
b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestInstanceOperation.java
index f117bea4b..0a6f1b4ee 100644
--- 
a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestInstanceOperation.java
+++ 
b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestInstanceOperation.java
@@ -1589,7 +1589,7 @@ public class TestInstanceOperation extends ZkTestBase {
         }
       }
       return true;
-    }, 120000, CLUSTER_NAME);
+    }, 180000, CLUSTER_NAME);
 
     // Cleanup
     removeOfflineOrInactiveInstances();
diff --git 
a/helix-core/src/test/java/org/apache/helix/messaging/handling/TestHelixTaskExecutor.java
 
b/helix-core/src/test/java/org/apache/helix/messaging/handling/TestHelixTaskExecutor.java
index e38031142..2520f76dc 100644
--- 
a/helix-core/src/test/java/org/apache/helix/messaging/handling/TestHelixTaskExecutor.java
+++ 
b/helix-core/src/test/java/org/apache/helix/messaging/handling/TestHelixTaskExecutor.java
@@ -911,6 +911,9 @@ public class TestHelixTaskExecutor {
       Thread.sleep(pollInterval);
     }
 
+    // Final wait to ensure all timeout cancellations are fully processed
+    Thread.sleep(500);
+
     LOG.info("After wait - Handlers created: {}, Processed: {}, TimedOut: {}",
         factory._handlersCreated, factory._processedMsgIds.size(), 
factory._timedOutMsgIds.size());
     LOG.info("Timed out message IDs: {}", factory._timedOutMsgIds.keySet());
@@ -960,6 +963,13 @@ public class TestHelixTaskExecutor {
     changeContext.setChangeType(HelixConstants.ChangeType.MESSAGE);
     executor.onMessage("someInstance", msgList, changeContext);
     Thread.sleep(3500);
+
+    // Wait for task map to be empty (all tasks completed or cancelled)
+    long startTime = System.currentTimeMillis();
+    while (executor._taskMap.size() > 0 && (System.currentTimeMillis() - 
startTime) < 1000) {
+      Thread.sleep(100);
+    }
+
     AssertJUnit.assertEquals(factory._processedMsgIds.size(), 3);
     
AssertJUnit.assertTrue(msgList.get(0).getRecord().getSimpleField("Cancelcount").equals("2"));
     
AssertJUnit.assertTrue(msgList.get(1).getRecord().getSimpleField("Cancelcount").equals("1"));

Reply via email to