Skip to content

Commit ba38069

Browse files
committed
HADOOP-19351. S3A: Add config option to skip test with performance mode
1 parent 964e089 commit ba38069

File tree

5 files changed

+31
-0
lines changed

5 files changed

+31
-0
lines changed

hadoop-tools/hadoop-aws/src/site/markdown/tools/hadoop-aws/performance.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ understands the risks.
295295
* If an option is to be tuned which may relax semantics, a new option MUST be defined.
296296
* Unknown flags are ignored; this is to avoid compatibility.
297297
* The option `*` means "turn everything on". This is implicitly unstable across releases.
298+
* Other stores may retain stricter semantics.
298299

299300
| *Option* | *Meaning* | Since |
300301
|----------|--------------------|:------|

hadoop-tools/hadoop-aws/src/site/markdown/tools/hadoop-aws/testing.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,10 @@ on third party stores.
628628
<name>test.fs.s3a.create.create.acl.enabled</name>
629629
<value>false</value>
630630
</property>
631+
<property>
632+
<name>test.fs.s3a.perf.enabled</name>
633+
<value>false</value>
634+
</property>
631635
```
632636

633637
See [Third Party Stores](third_party_stores.html) for more on this topic.
@@ -767,6 +771,18 @@ Tests in `ITestS3AContentEncoding` may need disabling
767771
<value>false</value>
768772
</property>
769773
```
774+
775+
### Disabling tests running in performance mode
776+
777+
Some tests running in performance mode turn off the safety checks. They expect breaking posix semantics.
778+
For stores with stricter semantics, these test cases must be disabled.
779+
```xml
780+
<property>
781+
<name>test.fs.s3a.perf.enabled</name>
782+
<value>false</value>
783+
</property>
784+
```
785+
770786
### Tests which may fail (and which you can ignore)
771787

772788
* `ITestS3AContractMultipartUploader` tests `testMultipartUploadAbort` and `testSingleUpload` raising `FileNotFoundException`

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@
2929
import org.apache.hadoop.fs.contract.AbstractFSContract;
3030
import org.apache.hadoop.fs.s3a.S3ATestUtils;
3131

32+
import static org.apache.hadoop.fs.s3a.S3ATestConstants.KEY_PERFORMANCE_TESTS_ENABLED;
3233
import static org.apache.hadoop.fs.s3a.Constants.CONNECTION_EXPECT_CONTINUE;
3334
import static org.apache.hadoop.fs.s3a.S3ATestUtils.removeBaseAndBucketOverrides;
3435
import static org.apache.hadoop.fs.s3a.S3ATestUtils.setPerformanceFlags;
36+
import static org.apache.hadoop.fs.s3a.S3ATestUtils.skipIfNotEnabled;
3537

3638
/**
3739
* S3A contract tests creating files.
@@ -84,6 +86,9 @@ protected Configuration createConfiguration() {
8486
conf,
8587
CONNECTION_EXPECT_CONTINUE);
8688
conf.setBoolean(CONNECTION_EXPECT_CONTINUE, expectContinue);
89+
if (createPerformance) {
90+
skipIfNotEnabled(conf, KEY_PERFORMANCE_TESTS_ENABLED, "Skipping tests running in performance mode");
91+
}
8792
S3ATestUtils.disableFilesystemCaching(conf);
8893
return conf;
8994
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929

3030
import static org.apache.hadoop.fs.contract.ContractTestUtils.createFile;
3131
import static org.apache.hadoop.fs.contract.ContractTestUtils.dataset;
32+
import static org.apache.hadoop.fs.s3a.S3ATestConstants.KEY_PERFORMANCE_TESTS_ENABLED;
3233
import static org.apache.hadoop.fs.s3a.S3ATestUtils.setPerformanceFlags;
34+
import static org.apache.hadoop.fs.s3a.S3ATestUtils.skipIfNotEnabled;
3335

3436
/**
3537
* Test mkdir operations on S3A with create performance mode.
@@ -50,6 +52,8 @@ protected AbstractFSContract createContract(Configuration conf) {
5052

5153
@Test
5254
public void testMkdirOverParentFile() throws Throwable {
55+
skipIfNotEnabled(getContract().getConf(), KEY_PERFORMANCE_TESTS_ENABLED,
56+
"Skipping tests running in performance mode");
5357
describe("try to mkdir where a parent is a file, should pass");
5458
FileSystem fs = getFileSystem();
5559
Path path = methodPath();

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ public interface S3ATestConstants {
6363
*/
6464
String KEY_ACL_TESTS_ENABLED = TEST_FS_S3A + "create.acl.enabled";
6565

66+
/**
67+
* A property set to true if tests running in performance mode are enabled: {@value }
68+
*/
69+
String KEY_PERFORMANCE_TESTS_ENABLED = TEST_FS_S3A + "perf.enabled";
70+
6671
/**
6772
* A property set to true if V1 tests are enabled: {@value}.
6873
*/

0 commit comments

Comments
 (0)