Skip to content

Commit db74b4a

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 6817cf3 commit db74b4a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

functional/TestArgs.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,8 @@ public static void skipStream(InputStream stream, int len) throws Exception {
323323
public static void handleException(String methodName, String args, long startTime, Exception e)
324324
throws Exception {
325325
if (e instanceof ErrorResponseException) {
326-
if (((ErrorResponseException) e).errorResponse().code().equals("NotImplemented")) {
326+
int code = ((ErrorResponseException) e).response().code();
327+
if (code == 405 || code == 501) {
327328
mintIgnoredLog(methodName, args, startTime);
328329
return;
329330
}

functional/TestMinioClient.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,8 @@ public void setup() throws Exception {
394394
MakeBucketArgs.builder().bucket(bucketNameWithLock).objectLock(true).build());
395395
} catch (Exception e) {
396396
if (e instanceof ErrorResponseException) {
397-
if (((ErrorResponseException) e).errorResponse().code().equals("NotImplemented")) {
397+
int code = ((ErrorResponseException) e).response().code();
398+
if (code == 405 || code == 501) {
398399
bucketNameWithLock = null;
399400
return;
400401
}

0 commit comments

Comments
 (0)