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

jxue 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 442be1122 fix flaky test assertion #2667 (#2682)
442be1122 is described below

commit 442be1122d68b6d356e3f918b7bdd34d465bf94b
Author: Simon Hofbauer <[email protected]>
AuthorDate: Tue Feb 27 18:32:08 2024 +0100

    fix flaky test assertion #2667 (#2682)
    
    fix flaky test assertion in org.apache.helix
    .rest.server.TestPerInstanceAccessor.testGetAllMessages
    
    Co-authored-by: simonh5 <[email protected]>
---
 .../java/org/apache/helix/rest/server/TestPerInstanceAccessor.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/helix-rest/src/test/java/org/apache/helix/rest/server/TestPerInstanceAccessor.java
 
b/helix-rest/src/test/java/org/apache/helix/rest/server/TestPerInstanceAccessor.java
index 355d5d101..f9e48ca1f 100644
--- 
a/helix-rest/src/test/java/org/apache/helix/rest/server/TestPerInstanceAccessor.java
+++ 
b/helix-rest/src/test/java/org/apache/helix/rest/server/TestPerInstanceAccessor.java
@@ -331,8 +331,11 @@ public class TestPerInstanceAccessor extends 
AbstractTestClass {
 
     Set<String> instances = OBJECT_MAPPER.readValue(instancesStr,
         OBJECT_MAPPER.getTypeFactory().constructCollectionType(Set.class, 
String.class));
-    Assert.assertEquals(instances, _instancesMap.get(CLUSTER_NAME), "Instances 
from response: "
-        + instances + " vs instances actually: " + 
_instancesMap.get(CLUSTER_NAME));
+    String errorMessage = "Instances from response: "+ instances + " vs 
instances actually: "
+        + _instancesMap.get(CLUSTER_NAME);
+    Assert.assertEquals(instances.size(), 
_instancesMap.get(CLUSTER_NAME).size(), errorMessage);
+    Assert.assertTrue(instances.containsAll(_instancesMap.get(CLUSTER_NAME)), 
errorMessage);
+    Assert.assertTrue(_instancesMap.get(CLUSTER_NAME).containsAll(instances), 
errorMessage);
     System.out.println("End test :" + TestHelper.getTestMethodName());
   }
 

Reply via email to