From 032247ff6e4d576f179a3db2050af6bedf9c716c Mon Sep 17 00:00:00 2001 From: Mike McCandless Date: Mon, 30 May 2016 06:37:19 -0400 Subject: [PATCH] LUCENE-7300: fix test bug to ensure the newly created file is in fact written through to the underlying filesystem even if NRTCachingDirectory is used --- .../apache/lucene/store/TestHardLinkCopyDirectoryWrapper.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lucene/misc/src/test/org/apache/lucene/store/TestHardLinkCopyDirectoryWrapper.java b/lucene/misc/src/test/org/apache/lucene/store/TestHardLinkCopyDirectoryWrapper.java index 819511b9c68..388b2f08f13 100644 --- a/lucene/misc/src/test/org/apache/lucene/store/TestHardLinkCopyDirectoryWrapper.java +++ b/lucene/misc/src/test/org/apache/lucene/store/TestHardLinkCopyDirectoryWrapper.java @@ -21,6 +21,7 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.attribute.BasicFileAttributes; +import java.util.Collections; import org.apache.lucene.codecs.CodecUtil; import org.apache.lucene.util.IOUtils; @@ -51,6 +52,8 @@ public class TestHardLinkCopyDirectoryWrapper extends BaseDirectoryTestCase { output.writeString("hey man, nice shot!"); CodecUtil.writeFooter(output); } + // In case luceneDir_1 has an NRTCachingDirectory + luceneDir_1.sync(Collections.singleton("foo.bar")); try { Files.createLink(tempDir.resolve("test"), dir_1.resolve("foo.bar")); BasicFileAttributes destAttr = Files.readAttributes(tempDir.resolve("test"), BasicFileAttributes.class);