Copilot commented on code in PR #11310:
URL: https://github.com/apache/gravitino/pull/11310#discussion_r3332053385
##########
core/src/test/java/org/apache/gravitino/storage/TestEntityStorageRelationCache.java:
##########
@@ -1468,6 +1468,148 @@ void testFunctionOwnerRelationCacheInvalidation(String
type, boolean enableCache
}
}
+ /**
+ * Reproduces GitHub issue #11297: after {@code revokePrivilegesFromRole}
removes the last
+ * privilege from a role's securable schema, {@code
+ * listEntitiesByRelation(METADATA_OBJECT_ROLE_REL)} must not return the
stale role from cache.
+ *
+ * <p>Flow: create schema + role → list binding roles (populates cache) →
update role to remove
+ * securable object (simulates revoke) → list binding roles again → must
reflect the change.
+ */
+ @ParameterizedTest
+ @MethodSource("storageProvider")
+ void testRevokePrivilegeInvalidatesMetadataObjectRoleRelCache(String type,
boolean enableCache)
+ throws Exception {
+ Config config = Mockito.mock(Config.class);
+ Mockito.when(config.get(Configs.CACHE_ENABLED)).thenReturn(enableCache);
+ init(type, config);
Review Comment:
`init(type, config)` stubs `Configs.CACHE_ENABLED` to `true` unconditionally
(see `AbstractEntityStorageTest.init`), which overrides the earlier
`thenReturn(enableCache)` and makes the `enableCache` parameter ineffective in
this test. Re-stub `CACHE_ENABLED` after `init` so the parameterized
`enableCache=false` case actually runs without cache and the conditional
assertions match the real store behavior.
--
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]