Skip to content

Commit

Permalink
fix flaky test assertion #2667 (#2682)
Browse files Browse the repository at this point in the history
fix flaky test assertion in org.apache.helix
.rest.server.TestPerInstanceAccessor.testGetAllMessages

Co-authored-by: simonh5 <[email protected]>
  • Loading branch information
hofi1 and simonh5 authored Feb 27, 2024
1 parent e8490f9 commit 442be11
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,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 442be11

Please sign in to comment.