From c0fa6dca1df11f63521bdd0f1ed5c3a5f969c813 Mon Sep 17 00:00:00 2001 From: Junkai Xue Date: Mon, 26 Feb 2024 17:45:36 -0800 Subject: [PATCH] Fix TestClusterAccessor test (#2767) * Fix TestClusterAccessor * change format --- .../org/apache/helix/rest/server/TestClusterAccessor.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/helix-rest/src/test/java/org/apache/helix/rest/server/TestClusterAccessor.java b/helix-rest/src/test/java/org/apache/helix/rest/server/TestClusterAccessor.java index d10ef9781f..e882cf0cea 100644 --- a/helix-rest/src/test/java/org/apache/helix/rest/server/TestClusterAccessor.java +++ b/helix-rest/src/test/java/org/apache/helix/rest/server/TestClusterAccessor.java @@ -99,7 +99,7 @@ public void testGetClusters() throws IOException { Set clusters = OBJECT_MAPPER.readValue(clustersStr, OBJECT_MAPPER.getTypeFactory().constructCollectionType(Set.class, String.class)); - Assert.assertEquals(clusters, _clusters); + Assert.assertTrue(isSame(clusters, _clusters)); validateAuditLogSize(1); AuditLog auditLog = _auditLogger.getAuditLogs().get(0); @@ -1528,6 +1528,11 @@ private void updateClusterConfigFromRest(String cluster, ClusterConfig newConfig Response.Status.OK.getStatusCode(), null); } + private boolean isSame(Set result, Set expected) { + return result.size() == expected.size() && result.containsAll(expected) && expected.containsAll( + result); + } + private void validateAuditLogSize(int expected) { Assert.assertEquals(_auditLogger.getAuditLogs().size(), expected, "AuditLog:" + _auditLogger.getAuditLogs().toString());