Skip to content

Commit

Permalink
Fix TestClusterAccessor test (#2767)
Browse files Browse the repository at this point in the history
* Fix TestClusterAccessor

* change format
  • Loading branch information
junkaixue authored Feb 27, 2024
1 parent 53b5889 commit c0fa6dc
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public void testGetClusters() throws IOException {

Set<String> 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);
Expand Down Expand Up @@ -1528,6 +1528,11 @@ private void updateClusterConfigFromRest(String cluster, ClusterConfig newConfig
Response.Status.OK.getStatusCode(), null);
}

private boolean isSame(Set<String> result, Set<String> 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());
Expand Down

0 comments on commit c0fa6dc

Please sign in to comment.