From 835f39cefc0627726d13561b1f1f10abb53e08e4 Mon Sep 17 00:00:00 2001 From: HanleyYang Date: Sat, 28 May 2022 12:26:07 +0800 Subject: [PATCH] HDFS-15878. RBF: Fix TestRouterWebHDFSContractCreate#testSyncable. (#4340). Contributed by Hanley Yang. Reviewed-by: Inigo Goiri Signed-off-by: Ayush Saxena --- .../contract/AbstractContractCreateTest.java | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) 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 85e1f84999..91d19ecad1 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 @@ -264,13 +264,8 @@ public void testCreatedFileIsEventuallyVisible() throws Throwable { describe("verify a written to file is visible after the stream is closed"); Path path = path("testCreatedFileIsEventuallyVisible"); FileSystem fs = getFileSystem(); - try( - FSDataOutputStream out = fs.create(path, - false, - 4096, - (short) 1, - 1024) - ) { + try(FSDataOutputStream out = fs.create(path, false, 4096, (short) 1, + 1024)) { out.write(0x01); out.close(); getFileStatusEventually(fs, path, CREATE_TIMEOUT); @@ -568,14 +563,14 @@ protected void validateSyncableSemantics(final FileSystem fs, in.close(); } catch (FileNotFoundException e) { - // that's OK if it's an object store, but not if its a real - // FS - if (!isSupported(IS_BLOBSTORE)) { + // that's OK if it's an object store or some file systems that newly created files + // are not immediately visible, but not if its a real FS + if (!isSupported(IS_BLOBSTORE) && !isSupported(CREATE_VISIBILITY_DELAYED)) { throw e; } else { LOG.warn( - "Output file was not created; this is an object store with different" - + " visibility semantics"); + "Output file was not created; this is an object store or " + + "a file system with different visibility semantics"); } } }