mchades commented on code in PR #14867:
URL: https://github.com/apache/gravitino/pull/14867#discussion_r4533149368
##########
catalogs/catalog-fileset/src/test/java/org/apache/gravitino/catalog/fileset/TestFilesetCatalogOperations.java:
##########
@@ -2843,6 +2843,40 @@ void
testTestConnectionPreservesLocationNotFoundAfterInitialization()
}
}
+ @Test
+ void testInitializeReportsStorageAccessFailureAsConnectionFailure() throws
IOException {
+ String location = "s3a://test-connection-bucket/catalog";
+ Path locationPath = new Path(location);
+ FileSystem fileSystem = Mockito.mock(FileSystem.class);
+ when(fileSystem.exists(any())).thenThrow(new IOException("Forbidden"));
+
+ try (FilesetCatalogOperations ops =
+ Mockito.spy(new FilesetCatalogOperations(store, secretManager))) {
+ Mockito.doReturn(fileSystem)
+ .when(ops)
+ .getFileSystemWithCache(Mockito.eq(locationPath), any(Map.class));
Review Comment:
This stub skips filesystem creation. If the provider throws an `IOException`
there, `getFileSystemWithCache()` wraps it before the new catch. I reproduced
HTTP 500 / code 1002 with a named GCS location. Please cover this case and
return the same sanitized HTTP 200 / code 1007 result for that initialization
failure.
##########
catalogs/catalog-fileset/src/main/java/org/apache/gravitino/catalog/fileset/FilesetCatalogOperations.java:
##########
@@ -1202,8 +1202,19 @@ private Map<String, Path>
getAndCheckCatalogStorageLocations(Map<String, String>
+ locationName);
}
} catch (IOException e) {
- throw ExceptionMessages.wrap(
- "Failed to check if fileset catalog location exists: " +
v, e);
+ // A storage-access failure here (e.g. forbidden bucket, bad
credentials) is a
+ // connection failure, not an internal error. Throw
ConnectionFailedException so
+ // that testConnection reports it as a connection-failed
result instead of HTTP
+ // 500, and identify the failing location.
+ throw new ConnectionFailedException(
+ e,
+ "%s",
+ ExceptionMessages.withCause(
Review Comment:
With an S3 403, `withCause` put the full storage URI, request ID, and proxy
address in the response `message`, even though the existing-catalog endpoint
omitted `stack`. Please reuse the probe’s location name and failure category
(e.g. `location-s3 (access denied)`), keep the original exception in the server
log, and update the test to assert the sanitized message.
--
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]