sachinnn99 commented on code in PR #10699:
URL: https://github.com/apache/gravitino/pull/10699#discussion_r3049983679
##########
iceberg/iceberg-rest-server/src/test/java/org/apache/gravitino/iceberg/service/rest/TestIcebergNamespaceOperations.java:
##########
@@ -257,4 +265,63 @@ void testUpdateNamespace() {
dummyEventListener.clearEvent();
verifyUpdateNamespaceSucc(Namespace.of("update_foo3", "a"));
}
+
+ @Test
+ void testRegisterTableWithCredentialVending() {
+ // register without credential vending — no credentials in response
+ verifyRegisterTableSucc("register_cred_foo1",
Namespace.of("register_cred_ns"));
+
+ // register with credential vending but local location — should NOT vend
+ Response response =
+ doRegisterTableWithCredentialVending(
+ "register_cred_foo2", Namespace.of("register_cred_ns2"), "mock");
+ Assertions.assertEquals(Status.OK.getStatusCode(), response.getStatus());
+ LoadTableResponse loadTableResponse =
response.readEntity(LoadTableResponse.class);
+
Assertions.assertTrue(!loadTableResponse.config().containsKey(Credential.CREDENTIAL_TYPE));
+
+ // register with credential vending and S3 location — SHOULD vend
+ String s3Location = "s3://dummy-bucket/register_cred_foo3";
+ response =
+ doRegisterTableWithCredentialVending(
+ "register_cred_foo3", Namespace.of("register_cred_ns3"),
s3Location);
+ Assertions.assertEquals(Status.OK.getStatusCode(), response.getStatus());
+ loadTableResponse = response.readEntity(LoadTableResponse.class);
+ Assertions.assertEquals(
Review Comment:
Added an additional assertion on `Credential.EXPIRE_TIME_IN_MS`.
`DummyCredentialProvider.SimpleCredential` is not one of the typed credentials
in `CredentialPropertyUtils.toIcebergProperties`, so it falls through to
`Credential#toProperties()`, which emits exactly `credential-type` and
`expire-time-in-ms`. Asserting both confirms the full credential block is
injected and guards against partial-injection regressions.
--
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]