nastra commented on code in PR #15752:
URL: https://github.com/apache/iceberg/pull/15752#discussion_r2982747979
##########
core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java:
##########
@@ -3740,6 +3746,72 @@ public void
testSequenceNumberConflictThrowsCommitFailed() {
.hasMessageContaining("Validation failed, please retry");
}
+ @Test
+ public void testIoBuilderReceivesStorageCredentials() {
+ Credential credential =
+ ImmutableCredential.builder()
+ .prefix("s3://test-bucket/")
+ .putConfig("s3.access-key-id", "test-access-key")
+ .putConfig("s3.secret-access-key", "test-secret-key")
+ .build();
+
+ // Adapter that injects storage credentials into LoadTableResponse
+ RESTCatalogAdapter adapter =
+ new RESTCatalogAdapter(backendCatalog) {
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T extends RESTResponse> T handleRequest(
+ Route route,
+ Map<String, String> vars,
+ HTTPRequest httpRequest,
+ Class<T> responseType,
+ Consumer<Map<String, String>> responseHeaders) {
+ T response =
+ super.handleRequest(route, vars, httpRequest, responseType,
responseHeaders);
+ if (route == Route.LOAD_TABLE && response instanceof
LoadTableResponse) {
Review Comment:
```suggestion
if (route == Route.LOAD_TABLE && response instanceof
LoadTableResponse loadResponse) {
```
##########
core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java:
##########
@@ -3740,6 +3746,72 @@ public void
testSequenceNumberConflictThrowsCommitFailed() {
.hasMessageContaining("Validation failed, please retry");
}
+ @Test
+ public void testIoBuilderReceivesStorageCredentials() {
+ Credential credential =
+ ImmutableCredential.builder()
+ .prefix("s3://test-bucket/")
+ .putConfig("s3.access-key-id", "test-access-key")
+ .putConfig("s3.secret-access-key", "test-secret-key")
+ .build();
+
+ // Adapter that injects storage credentials into LoadTableResponse
+ RESTCatalogAdapter adapter =
+ new RESTCatalogAdapter(backendCatalog) {
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T extends RESTResponse> T handleRequest(
+ Route route,
+ Map<String, String> vars,
+ HTTPRequest httpRequest,
+ Class<T> responseType,
+ Consumer<Map<String, String>> responseHeaders) {
+ T response =
+ super.handleRequest(route, vars, httpRequest, responseType,
responseHeaders);
+ if (route == Route.LOAD_TABLE && response instanceof
LoadTableResponse) {
+ LoadTableResponse loadResponse = (LoadTableResponse) response;
Review Comment:
```suggestion
```
--
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]