diff --git a/.gitignore b/.gitignore index 5925ec48c9d..eb1fc967416 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,5 @@ yarnregistry.pdf hadoop-tools/hadoop-aws/src/test/resources/auth-keys.xml hadoop-tools/hadoop-aws/src/test/resources/contract-test-options.xml hadoop-tools/hadoop-azure/src/test/resources/azure-auth-keys.xml +hadoop-tools/hadoop-openstack/src/test/resources/auth-keys.xml patchprocess/ diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/AbstractContractCreateTest.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/AbstractContractCreateTest.java index 9344225d175..84dc775b983 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/AbstractContractCreateTest.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/AbstractContractCreateTest.java @@ -121,7 +121,7 @@ public abstract class AbstractContractCreateTest extends try { assertIsDirectory(path); } catch (AssertionError failure) { - if (isSupported(IS_BLOBSTORE)) { + if (isSupported(CREATE_OVERWRITES_DIRECTORY)) { // file/directory hack surfaces here throw new AssumptionViolatedException(failure.toString(), failure); } @@ -137,10 +137,10 @@ public abstract class AbstractContractCreateTest extends FileStatus status = getFileSystem().getFileStatus(path); boolean isDir = status.isDirectory(); - if (!isDir && isSupported(IS_BLOBSTORE)) { - // object store: downgrade to a skip so that the failure is visible - // in test results - skip("Object store allows a file to overwrite a directory"); + if (!isDir && isSupported(CREATE_OVERWRITES_DIRECTORY)) { + // For some file systems, downgrade to a skip so that the failure is + // visible in test results. + skip("This Filesystem allows a file to overwrite a directory"); } fail("write of file over dir succeeded"); } catch (FileAlreadyExistsException expected) { @@ -170,10 +170,10 @@ public abstract class AbstractContractCreateTest extends 1024)) { if (!getFileSystem().exists(path)) { - if (isSupported(IS_BLOBSTORE)) { - // object store: downgrade to a skip so that the failure is visible - // in test results - skip("Filesystem is an object store and newly created files are not immediately visible"); + if (isSupported(CREATE_VISIBILITY_DELAYED)) { + // For some file systems, downgrade to a skip so that the failure is + // visible in test results. + skip("This Filesystem delays visibility of newly created files"); } assertPathExists("expected path to be visible before anything written", path); diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/ContractOptions.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/ContractOptions.java index c8af0625858..b778f0d8542 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/ContractOptions.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/ContractOptions.java @@ -36,17 +36,34 @@ public interface ContractOptions { */ String FS_CONTRACT_KEY = "fs.contract."; + /** + * Flag to indicate that a newly created file may overwrite a pre-existing + * directory. + * {@value} + */ + String CREATE_OVERWRITES_DIRECTORY = "create-overwrites-directory"; + + /** + * Flag to indicate that a newly created file is not made visible in the + * namespace immediately. Instead, the file becomes visible at a later point + * in the file creation lifecycle, such as when the client closes it. + * {@value} + */ + String CREATE_VISIBILITY_DELAYED = "create-visibility-delayed"; + /** * Is a filesystem case sensitive. * Some of the filesystems that say "no" here may mean * that it varies from platform to platform -the localfs being the key * example. + * {@value} */ String IS_CASE_SENSITIVE = "is-case-sensitive"; /** * Blobstore flag. Implies it's not a real directory tree and * consistency is below that which Hadoop expects + * {@value} */ String IS_BLOBSTORE = "is-blobstore"; @@ -196,6 +213,7 @@ public interface ContractOptions { /** * Limit for #of random seeks to perform. * Keep low for remote filesystems for faster tests + * {@value} */ String TEST_RANDOM_SEEK_COUNT = "test.random-seek-count"; diff --git a/hadoop-common-project/hadoop-common/src/test/resources/contract/ftp.xml b/hadoop-common-project/hadoop-common/src/test/resources/contract/ftp.xml index 9c3e380718c..f95446eb30a 100644 --- a/hadoop-common-project/hadoop-common/src/test/resources/contract/ftp.xml +++ b/hadoop-common-project/hadoop-common/src/test/resources/contract/ftp.xml @@ -26,11 +26,6 @@ false - - fs.contract.is-blobstore - false - - fs.contract.is-case-sensitive true @@ -81,4 +76,4 @@ false - \ No newline at end of file + diff --git a/hadoop-tools/hadoop-aws/src/test/resources/contract/s3.xml b/hadoop-tools/hadoop-aws/src/test/resources/contract/s3.xml index 4b742c10529..49acd3b1d56 100644 --- a/hadoop-tools/hadoop-aws/src/test/resources/contract/s3.xml +++ b/hadoop-tools/hadoop-aws/src/test/resources/contract/s3.xml @@ -36,6 +36,16 @@ true + + fs.contract.create-overwrites-directory + true + + + + fs.contract.create-visibility-delayed + true + + fs.contract.is-case-sensitive true diff --git a/hadoop-tools/hadoop-aws/src/test/resources/contract/s3a.xml b/hadoop-tools/hadoop-aws/src/test/resources/contract/s3a.xml index be1e7ca6535..a534f0a77b2 100644 --- a/hadoop-tools/hadoop-aws/src/test/resources/contract/s3a.xml +++ b/hadoop-tools/hadoop-aws/src/test/resources/contract/s3a.xml @@ -37,6 +37,11 @@ true + + fs.contract.create-visibility-delayed + true + + fs.contract.is-case-sensitive true diff --git a/hadoop-tools/hadoop-aws/src/test/resources/contract/s3n.xml b/hadoop-tools/hadoop-aws/src/test/resources/contract/s3n.xml index cb8aca7d644..0c6b8c69b7f 100644 --- a/hadoop-tools/hadoop-aws/src/test/resources/contract/s3n.xml +++ b/hadoop-tools/hadoop-aws/src/test/resources/contract/s3n.xml @@ -37,6 +37,16 @@ true + + fs.contract.create-overwrites-directory + true + + + + fs.contract.create-visibility-delayed + true + + fs.contract.is-case-sensitive true diff --git a/hadoop-tools/hadoop-openstack/src/test/resources/contract/swift.xml b/hadoop-tools/hadoop-openstack/src/test/resources/contract/swift.xml index 12a67e0290a..fbf3a177c91 100644 --- a/hadoop-tools/hadoop-openstack/src/test/resources/contract/swift.xml +++ b/hadoop-tools/hadoop-openstack/src/test/resources/contract/swift.xml @@ -37,6 +37,16 @@ true + + fs.contract.create-overwrites-directory + true + + + + fs.contract.create-visibility-delayed + true + + fs.contract.is-case-sensitive true