Skip to content

Commit 6ca49d5

Browse files
committed
HADOOP-19646. Migrate hadoop-aws module from JUnit4 Assume to JUnit5 Assumptions.
1 parent cf4f97d commit 6ca49d5

5 files changed

Lines changed: 12 additions & 17 deletions

File tree

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3ABlockOutputDisk.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
package org.apache.hadoop.fs.s3a;
2020

21-
import org.junit.Assume;
21+
import org.junit.jupiter.api.Assumptions;
2222

2323
/**
2424
* Use {@link Constants#FAST_UPLOAD_BUFFER_DISK} for buffering.
@@ -36,7 +36,7 @@ protected String getBlockOutputBufferName() {
3636
* @return null
3737
*/
3838
protected S3ADataBlocks.BlockFactory createFactory(S3AFileSystem fileSystem) {
39-
Assume.assumeTrue("mark/reset not supported", false);
39+
Assumptions.assumeTrue(false, "mark/reset not supported");
4040
return null;
4141
}
4242
}

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3ADelayedFNF.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import org.apache.hadoop.fs.s3a.impl.ChangeDetectionPolicy.Source;
2727
import org.apache.hadoop.test.LambdaTestUtils;
2828

29-
import org.junit.Assume;
29+
import org.junit.jupiter.api.Assumptions;
3030
import org.junit.jupiter.api.Test;
3131

3232
import java.io.FileNotFoundException;
@@ -68,9 +68,8 @@ public void testNotFoundFirstRead() throws Exception {
6868
S3AFileSystem fs = getFileSystem();
6969
ChangeDetectionPolicy changeDetectionPolicy =
7070
fs.getChangeDetectionPolicy();
71-
Assume.assumeFalse("FNF not expected when using a bucket with"
72-
+ " object versioning",
73-
changeDetectionPolicy.getSource() == Source.VersionId);
71+
Assumptions.assumeFalse(changeDetectionPolicy.getSource() == Source.VersionId,
72+
"FNF not expected when using a bucket with object versioning");
7473

7574
Path p = path("some-file");
7675
ContractTestUtils.createFile(fs, p, false, new byte[] {20, 21, 22});

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/S3ATestUtils.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171

7272
import org.assertj.core.api.Assertions;
7373
import org.assertj.core.api.Assumptions;
74-
import org.junit.Assume;
7574
import org.opentest4j.TestAbortedException;
7675
import org.slf4j.Logger;
7776
import org.slf4j.LoggerFactory;
@@ -234,8 +233,7 @@ public static S3AFileSystem createTestFileSystem(Configuration conf,
234233
}
235234
// This doesn't work with our JUnit 3 style test cases, so instead we'll
236235
// make this whole class not run by default
237-
Assume.assumeTrue("No test filesystem in " + TEST_FS_S3A_NAME,
238-
liveTest);
236+
Assumptions.assumeThat(liveTest).isTrue().as("No test filesystem in " + TEST_FS_S3A_NAME);
239237

240238
S3AFileSystem fs1 = new S3AFileSystem();
241239
//enable purging in tests
@@ -276,8 +274,7 @@ public static FileContext createTestFileContext(Configuration conf)
276274
}
277275
// This doesn't work with our JUnit 3 style test cases, so instead we'll
278276
// make this whole class not run by default
279-
Assume.assumeTrue("No test filesystem in " + TEST_FS_S3A_NAME,
280-
liveTest);
277+
Assumptions.assumeThat(liveTest).isTrue().as("No test filesystem in " + TEST_FS_S3A_NAME);
281278
FileContext fc = FileContext.getFileContext(testURI, conf);
282279
return fc;
283280
}

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/auth/RoleTestUtils.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import java.util.stream.IntStream;
2727

2828
import com.fasterxml.jackson.core.JsonProcessingException;
29-
import org.junit.Assume;
29+
import org.junit.jupiter.api.Assumptions;
3030
import org.slf4j.Logger;
3131
import org.slf4j.LoggerFactory;
3232

@@ -212,8 +212,7 @@ public static <T> AccessDeniedException forbidden(
212212
*/
213213
public static String probeForAssumedRoleARN(Configuration conf) {
214214
String arn = conf.getTrimmed(ASSUMED_ROLE_ARN, "");
215-
Assume.assumeTrue("No ARN defined in " + ASSUMED_ROLE_ARN,
216-
!arn.isEmpty());
215+
Assumptions.assumeTrue(!arn.isEmpty(), "No ARN defined in " + ASSUMED_ROLE_ARN);
217216
return arn;
218217
}
219218

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/test/PublicDatasetTestUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
package org.apache.hadoop.fs.s3a.test;
2020

21-
import org.junit.Assume;
21+
import org.junit.jupiter.api.Assumptions;
2222

2323
import org.apache.hadoop.classification.InterfaceAudience;
2424
import org.apache.hadoop.classification.InterfaceStability;
@@ -128,8 +128,8 @@ public static Path requireAnonymousDataPath(Configuration conf) {
128128
*/
129129
public static String requireDefaultExternalDataFile(Configuration conf) {
130130
String filename = getExternalData(conf).toUri().toString();
131-
Assume.assumeTrue("External test file is not the default",
132-
DEFAULT_EXTERNAL_FILE.equals(filename));
131+
Assumptions.assumeTrue(DEFAULT_EXTERNAL_FILE.equals(filename),
132+
"External test file is not the default");
133133
return filename;
134134
}
135135

0 commit comments

Comments
 (0)