You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by qq...@apache.org on 2023/05/20 17:34:09 UTC

[helix] branch master updated: Fix for Failed-CI test: testSubMessageFailed (#2496)

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

qqu 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 9c9489af0 Fix for Failed-CI test: testSubMessageFailed (#2496)
9c9489af0 is described below

commit 9c9489af049e4f85c05ecda42c3784500317bb01
Author: Komal Desai <98...@users.noreply.github.com>
AuthorDate: Sat May 20 10:34:04 2023 -0700

    Fix for Failed-CI test: testSubMessageFailed (#2496)
    
    Replace Thread.Sleep with verifier.
---
 .../integration/TestBatchMessageHandling.java      | 31 +++++++++++++---------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestBatchMessageHandling.java b/helix-core/src/test/java/org/apache/helix/integration/TestBatchMessageHandling.java
index 6e6775768..42d111de2 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestBatchMessageHandling.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestBatchMessageHandling.java
@@ -93,20 +93,25 @@ public class TestBatchMessageHandling extends ZkStandAloneCMTestBase {
     Assert.assertTrue(_clusterVerifier.verifyByPolling());
     Thread.sleep(2000L);
 
-    int numOfOnlines = 0;
-    int numOfErrors = 0;
-    ExternalView externalView =
-        _gSetupTool.getClusterManagementTool().getResourceExternalView(CLUSTER_NAME, dbName);
-    for (String partition : externalView.getPartitionSet()) {
-      if (externalView.getStateMap(partition).values().contains("ONLINE")) {
-        numOfOnlines++;
-      }
-      if (externalView.getStateMap(partition).values().contains("ERROR")) {
-        numOfErrors++;
+    result = TestHelper.verify(() -> {
+      int numOfOnlines = 0;
+      int numOfErrors = 0;
+      ExternalView externalView =
+          _gSetupTool.getClusterManagementTool().getResourceExternalView(CLUSTER_NAME, dbName);
+      for (String partition : externalView.getPartitionSet()) {
+        if (externalView.getStateMap(partition).values().contains("ONLINE")) {
+          numOfOnlines++;
+        }
+        if (externalView.getStateMap(partition).values().contains("ERROR")) {
+          numOfErrors++;
+        }
       }
-    }
-    Assert.assertEquals(numOfErrors, 4);
-    Assert.assertEquals(numOfOnlines, 6);
+      if (numOfErrors == 4 && numOfOnlines == 6) {
+        return true;
+      } 
+      return false;
+    }, TestHelper.WAIT_DURATION);
+    Assert.assertTrue(result);
   }
 
   public static class TestOnlineOfflineStateModelFactory