Skip to content

Commit

Permalink
Fix flaky test assertion #2644 (#2665)
Browse files Browse the repository at this point in the history
in org.apache.helix.rest.server.
TestInstancesAccessor#testGetAllInstances

Co-authored-by: simonh5 <[email protected]>
  • Loading branch information
hofi1 and simonh5 authored Feb 27, 2024
1 parent 1eea253 commit ebda6a4
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,12 @@ public void testGetAllInstances() throws IOException {

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());
}

Expand Down

0 comments on commit ebda6a4

Please sign in to comment.