HDFS-15878. RBF: Fix TestRouterWebHDFSContractCreate#testSyncable. (#4340). Contributed by Hanley Yang.

Reviewed-by: Inigo Goiri <inigoiri@apache.org>
Signed-off-by: Ayush Saxena <ayushsaxena@apache.org>
This commit is contained in:
HanleyYang 2022-05-28 12:26:07 +08:00 committed by GitHub
parent 995f7b0956
commit 835f39cefc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -264,13 +264,8 @@ public void testCreatedFileIsEventuallyVisible() throws Throwable {
describe("verify a written to file is visible after the stream is closed"); describe("verify a written to file is visible after the stream is closed");
Path path = path("testCreatedFileIsEventuallyVisible"); Path path = path("testCreatedFileIsEventuallyVisible");
FileSystem fs = getFileSystem(); FileSystem fs = getFileSystem();
try( try(FSDataOutputStream out = fs.create(path, false, 4096, (short) 1,
FSDataOutputStream out = fs.create(path, 1024)) {
false,
4096,
(short) 1,
1024)
) {
out.write(0x01); out.write(0x01);
out.close(); out.close();
getFileStatusEventually(fs, path, CREATE_TIMEOUT); getFileStatusEventually(fs, path, CREATE_TIMEOUT);
@ -568,14 +563,14 @@ protected void validateSyncableSemantics(final FileSystem fs,
in.close(); in.close();
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
// that's OK if it's an object store, but not if its a real // that's OK if it's an object store or some file systems that newly created files
// FS // are not immediately visible, but not if its a real FS
if (!isSupported(IS_BLOBSTORE)) { if (!isSupported(IS_BLOBSTORE) && !isSupported(CREATE_VISIBILITY_DELAYED)) {
throw e; throw e;
} else { } else {
LOG.warn( LOG.warn(
"Output file was not created; this is an object store with different" "Output file was not created; this is an object store or "
+ " visibility semantics"); + "a file system with different visibility semantics");
} }
} }
} }