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 ebda6a4c4 Fix flaky test assertion #2644 (#2665)
ebda6a4c4 is described below
commit ebda6a4c4c3a6103f3f7a8b080afeba17dd3d9fe
Author: Simon Hofbauer <[email protected]>
AuthorDate: Tue Feb 27 18:33:05 2024 +0100
Fix flaky test assertion #2644 (#2665)
in org.apache.helix.rest.server.
TestInstancesAccessor#testGetAllInstances
Co-authored-by: simonh5 <[email protected]>
---
.../java/org/apache/helix/rest/server/TestInstancesAccessor.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git
a/helix-rest/src/test/java/org/apache/helix/rest/server/TestInstancesAccessor.java
b/helix-rest/src/test/java/org/apache/helix/rest/server/TestInstancesAccessor.java
index 5cfab76a0..93722f05a 100644
---
a/helix-rest/src/test/java/org/apache/helix/rest/server/TestInstancesAccessor.java
+++
b/helix-rest/src/test/java/org/apache/helix/rest/server/TestInstancesAccessor.java
@@ -405,8 +405,12 @@ public class TestInstancesAccessor 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));
+ Assert.assertEquals(instances.size(),
_instancesMap.get(CLUSTER_NAME).size(), "Different amount of elements in "
+ + "the sets: " + instances.size() + " vs: " +
_instancesMap.get(CLUSTER_NAME).size());
+ Assert.assertTrue(instances.containsAll(_instancesMap.get(CLUSTER_NAME)),
"instances set does not contain all "
+ + "elements of _instanceMap");
+ Assert.assertTrue(_instancesMap.get(CLUSTER_NAME).containsAll(instances),
"_instanceMap set does not contain all "
+ + "elements of instances");
System.out.println("End test :" + TestHelper.getTestMethodName());
}