LuciferYang commented on code in PR #13440:
URL: https://github.com/apache/gravitino/pull/13440#discussion_r4084080073
##########
core/src/test/java/org/apache/gravitino/secret/TestSecretManagerAlter.java:
##########
@@ -55,17 +60,33 @@ void testAlterSetSecretBindingWritesAndReturnsUrn() {
}
@Test
- void testAlterRemovePropertyDeletesWriteThroughSecret() {
+ void testAlterRemovePropertyDefersWriteThroughSecretDeletion() {
try (SecretManager secretManager = memorySecretManager()) {
Map<String, String> props = new HashMap<>();
List<SecretMaterial> written = new ArrayList<>();
+ List<SecretUrn> replacedUrns = new ArrayList<>();
String urn =
secretManager.alterSetSecretBinding(
- props, "catalog", 7L, "jdbc-password", new
SecretBinding("memory", "old"), written);
+ props,
+ "catalog",
+ 7L,
+ "jdbc-password",
+ new SecretBinding("memory", "old"),
+ written,
+ replacedUrns);
- secretManager.alterRemoveProperty(props, "catalog", 7L, "jdbc-password");
+ secretManager.alterRemoveProperty(props, "catalog", 7L, "jdbc-password",
replacedUrns);
Assertions.assertFalse(props.containsKey("jdbc-password"));
+ // Deletion is deferred until the alter commits: the removed URN must
stay
+ // resolvable while the alter may still abort.
+ Assertions.assertEquals(
+ "old",
+
secretManager.getRegistry().getProvider("memory").readSecret(SecretUrn.parse(urn)));
Review Comment:
Done. The test now asserts `replacedUrns.size() == 1` before indexing, so an
empty list fails with a clear size mismatch rather than an
`IndexOutOfBoundsException`.
--
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]