jojochuang commented on code in PR #11820:
URL: https://github.com/apache/ozone/pull/11820#discussion_r4418783938
##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestOMMultiTenantManagerImpl.java:
##########
@@ -184,6 +188,25 @@ public void testGetTenantForAccessId() throws Exception {
assertEquals(TENANT_ID, optionalTenant.get());
}
+ @Test
+ public void testIsTenantAdminSkipsMissingAccessId() throws IOException {
+ final String missingAccessId = "tenant1$bob";
+ final String adminAccessId = "tenant2$bob";
+ omMetadataManager.getPrincipalToAccessIdsTable().put("bob",
+ new OmDBUserPrincipalInfo(new HashSet<>(Arrays.asList(missingAccessId,
adminAccessId))));
+ assignUserToTenantInDB("tenant2", adminAccessId, "bob", true, false);
+ // An unlocked reader can still see an accessId in the principal row after
its accessId row is removed.
+ // Ensure the missing entry is checked before the valid admin entry to
exercise the regression.
+
assertThat(omMetadataManager.getPrincipalToAccessIdsTable().get("bob").getAccessIds())
+ .first().isEqualTo(missingAccessId);
Review Comment:
Could we make the missing-accessId-first order deterministic in this test?
The fixture stores the IDs in a HashSet, whose iteration order is not
guaranteed, then asserts that the missing ID is first. That assertion checks
the current ordering but does not enforce it, so an implementation/runtime
change could fail the test before it reaches the behavior under test. Please
control the iteration order seen by isTenantAdmin (accounting for any set
reconstruction during table serialization), so the regression reliably
exercises a missing entry followed by a valid admin entry.
Generated-by: Codex (GPT-6)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]