Skip to content

Commit

Permalink
fix flaky test assertion apache#2667
Browse files Browse the repository at this point in the history
fix flaky test assertion in org.apache.helix
.rest.server.TestPerInstanceAccessor.testGetAllMessages
  • Loading branch information
simonh5 committed Oct 27, 2023
1 parent 6241bcb commit e0b1834
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,11 @@ 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));
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());
}

Expand Down

0 comments on commit e0b1834

Please sign in to comment.