From 3216a09610899a2570d05bb1780c6a7a6328a53a Mon Sep 17 00:00:00 2001 From: simonh5 Date: Tue, 3 Oct 2023 00:12:29 -0500 Subject: [PATCH] Fix flaky test (#2643) in org.apache.helix.rest.server. TestResourceAccessor#testGetResources --- .../org/apache/helix/rest/server/TestResourceAccessor.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/helix-rest/src/test/java/org/apache/helix/rest/server/TestResourceAccessor.java b/helix-rest/src/test/java/org/apache/helix/rest/server/TestResourceAccessor.java index ce11b2f1b9d..2b302785f66 100644 --- a/helix-rest/src/test/java/org/apache/helix/rest/server/TestResourceAccessor.java +++ b/helix-rest/src/test/java/org/apache/helix/rest/server/TestResourceAccessor.java @@ -75,8 +75,11 @@ public void testGetResources() throws IOException { Set resources = OBJECT_MAPPER.readValue(idealStates, OBJECT_MAPPER.getTypeFactory().constructCollectionType(Set.class, String.class)); - Assert.assertEquals(resources, _resourcesMap.get("TestCluster_0"), "Resources from response: " - + resources + " vs clusters actually: " + _resourcesMap.get("TestCluster_0")); + Assert.assertEquals(resources.size(), _resourcesMap.get("TestCluster_0").size(), "Sizes are not equal"); + Assert.assertTrue(resources.containsAll(_resourcesMap.get("TestCluster_0")), "resources does not contain all " + + "elements from _resourcesMap"); + Assert.assertTrue(_resourcesMap.get("TestCluster_0").containsAll(resources), "_resourcesMap does not contain all " + + "elements from resources"); System.out.println("End test :" + TestHelper.getTestMethodName()); }