Skip to content

Commit 884db7f

Browse files
fix: skip functional tests on HTTP 405/501 responses
Use HTTP status codes directly instead of checking error code strings, so tests are properly skipped when APIs return 405 (Method Not Allowed) or 501 (Not Implemented).
1 parent 044c33c commit 884db7f

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

functional/FunctionalTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,8 @@ public static void skipStream(InputStream stream, int len) throws Exception {
430430
public static void handleException(String methodName, String args, long startTime, Exception e)
431431
throws Exception {
432432
if (e instanceof ErrorResponseException) {
433-
if (((ErrorResponseException) e).errorResponse().code().equals("NotImplemented")) {
433+
int code = ((ErrorResponseException) e).response().code();
434+
if (code == 405 || code == 501) {
434435
mintIgnoredLog(methodName, args, startTime);
435436
return;
436437
}
@@ -709,7 +710,8 @@ public static void setup() throws Exception {
709710
MakeBucketArgs.builder().bucket(bucketNameWithLock).objectLock(true).build());
710711
} catch (Exception e) {
711712
if (e instanceof ErrorResponseException) {
712-
if (((ErrorResponseException) e).errorResponse().code().equals("NotImplemented")) {
713+
int code = ((ErrorResponseException) e).response().code();
714+
if (code == 405 || code == 501) {
713715
bucketNameWithLock = null;
714716
return;
715717
}

0 commit comments

Comments
 (0)