alessandro-nori commented on code in PR #15051:
URL: https://github.com/apache/iceberg/pull/15051#discussion_r2719010258
##########
core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java:
##########
@@ -2543,6 +2543,74 @@ public void
testNoCleanupForNonCleanableCreateTransaction() {
});
}
+ @Test
+ public void testNoCleanup503MappedToCommitStateUnknownCreateTransaction() {
+ RESTCatalogAdapter adapter =
+ Mockito.spy(
+ new RESTCatalogAdapter(backendCatalog) {
+ @Override
+ protected <T extends RESTResponse> T execute(
+ HTTPRequest request,
+ Class<T> responseType,
+ Consumer<ErrorResponse> errorHandler,
+ Consumer<Map<String, String>> responseHeaders) {
+ if (request.method() == HTTPMethod.POST &&
request.path().contains("some_table")) {
+ // Simulate a 503 Service Unavailable error
+ ErrorResponse error =
+ ErrorResponse.builder()
+ .responseCode(503)
+ .withMessage("Service unavailable")
+ .build();
+
+ errorHandler.accept(error);
+ throw new IllegalStateException("Error handler should have
thrown");
+ }
+ return super.execute(request, responseType, errorHandler,
responseHeaders);
Review Comment:
Thank you very much for your review.
My goal was to test that the new ErrorHandler is correctly mapping `503`
errors to `CommitStateUnknownException`.
I tried debugging what you suggested but the ErrorHandler code is not called
in that case. There is already a test to check that **not** `CleanableFailure`s
like `ServiceFailureException` do not delete files
https://github.com/apache/iceberg/blob/0b83a6359d6af1bf7fbacb62ec819c5c47dee404/core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java#L2505-L2544
My new test instead fails without the new error handler.
I don't have enough expertise in Java so it's very possible I'm doing
something wrong.
--
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]