Skip to content

Commit eaa03ab

Browse files
authored
Ignore functional tests for unsupported bucket with locking (#1130)
Fixes #1129
1 parent d5b509b commit eaa03ab

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

functional/FunctionalTest.java

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,13 @@ public static void setup() throws Exception {
689689
client.makeBucket(
690690
MakeBucketArgs.builder().bucket(bucketNameWithLock).objectLock(true).build());
691691
} catch (Exception e) {
692+
if (e instanceof ErrorResponseException) {
693+
if (((ErrorResponseException) e).errorResponse().code().equals("NotImplemented")) {
694+
bucketNameWithLock = null;
695+
return;
696+
}
697+
}
698+
692699
handleException("makeBucket()", "[object lock]", startTime, e);
693700
}
694701
}
@@ -926,14 +933,16 @@ public static void putObject() throws Exception {
926933
.build(),
927934
null);
928935

929-
testPutObject(
930-
"[with retention]",
931-
PutObjectArgs.builder().bucket(bucketNameWithLock).object(getRandomName()).stream(
932-
new ContentInputStream(1 * KB), 1 * KB, -1)
933-
.retention(
934-
new Retention(RetentionMode.GOVERNANCE, ZonedDateTime.now(Time.UTC).plusDays(1)))
935-
.build(),
936-
null);
936+
if (bucketNameWithLock != null) {
937+
testPutObject(
938+
"[with retention]",
939+
PutObjectArgs.builder().bucket(bucketNameWithLock).object(getRandomName()).stream(
940+
new ContentInputStream(1 * KB), 1 * KB, -1)
941+
.retention(
942+
new Retention(RetentionMode.GOVERNANCE, ZonedDateTime.now(Time.UTC).plusDays(1)))
943+
.build(),
944+
null);
945+
}
937946

938947
testThreadedPutObject();
939948

@@ -2313,6 +2322,8 @@ public static void checkObjectLegalHold(String bucketName, String objectName, bo
23132322
}
23142323

23152324
public static void enableObjectLegalHold() throws Exception {
2325+
if (bucketNameWithLock == null) return;
2326+
23162327
String methodName = "enableObjectLegalHold()";
23172328
if (!mintEnv) {
23182329
System.out.println(methodName);
@@ -2351,6 +2362,8 @@ public static void enableObjectLegalHold() throws Exception {
23512362
}
23522363

23532364
public static void disableObjectLegalHold() throws Exception {
2365+
if (bucketNameWithLock == null) return;
2366+
23542367
String methodName = "disableObjectLegalHold()";
23552368
if (!mintEnv) {
23562369
System.out.println(methodName);
@@ -2391,6 +2404,8 @@ public static void disableObjectLegalHold() throws Exception {
23912404
}
23922405

23932406
public static void isObjectLegalHoldEnabled() throws Exception {
2407+
if (bucketNameWithLock == null) return;
2408+
23942409
String methodName = "isObjectLegalHoldEnabled()";
23952410
if (!mintEnv) {
23962411
System.out.println(methodName);
@@ -2534,6 +2549,8 @@ public static void deleteObjectLockConfiguration() throws Exception {
25342549
}
25352550

25362551
public static void setObjectRetention() throws Exception {
2552+
if (bucketNameWithLock == null) return;
2553+
25372554
String methodName = "setObjectRetention()";
25382555
if (!mintEnv) {
25392556
System.out.println(methodName);
@@ -2614,6 +2631,8 @@ public static void testGetObjectRetention(SetObjectRetentionArgs args) throws Ex
26142631
}
26152632

26162633
public static void getObjectRetention() throws Exception {
2634+
if (bucketNameWithLock == null) return;
2635+
26172636
String methodName = "getObjectRetention()";
26182637
if (!mintEnv) {
26192638
System.out.println(methodName);

0 commit comments

Comments
 (0)