Skip to content

Commit f38d707

Browse files
authored
HADOOP-19351. S3A: Add config option to skip test with performance mode (#7223)
The option test.fs.s3a.performance.enabled can be set to false to disable tests of s3 stores which knowingly break posix semantics. These tests need to be disabled when testing object stores which do enforce a strict model of directories and files underneath the S3 API. Contributed by Chung En Lee
1 parent c3e3228 commit f38d707

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

+1
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ understands the risks.
294294
* If an option is to be tuned which may relax semantics, a new option MUST be defined.
295295
* Unknown flags are ignored; this is to avoid compatibility.
296296
* The option `*` means "turn everything on". This is implicitly unstable across releases.
297+
* Other stores may retain stricter semantics.
297298

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

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

+16
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,10 @@ on third party stores.
581581
<name>test.fs.s3a.create.create.acl.enabled</name>
582582
<value>false</value>
583583
</property>
584+
<property>
585+
<name>test.fs.s3a.performance.enabled</name>
586+
<value>false</value>
587+
</property>
584588
```
585589

586590
See [Third Party Stores](third_party_stores.html) for more on this topic.
@@ -720,6 +724,18 @@ Tests in `ITestS3AContentEncoding` may need disabling
720724
<value>false</value>
721725
</property>
722726
```
727+
728+
### Disabling tests running in performance mode
729+
730+
Some tests running in performance mode turn off the safety checks. They expect operations which break POSIX semantics to succeed.
731+
For stores with stricter semantics, these test cases must be disabled.
732+
```xml
733+
<property>
734+
<name>test.fs.s3a.performance.enabled</name>
735+
<value>false</value>
736+
</property>
737+
```
738+
723739
### Tests which may fail (and which you can ignore)
724740

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

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

+5
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

+4
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

+5
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 + "performance.enabled";
70+
6671
/**
6772
* A property set to true if V1 tests are enabled: {@value}.
6873
*/

0 commit comments

Comments
 (0)