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

This commit is contained in:
Mike McCandless 2016-05-30 06:37:19 -04:00
parent ecec5244df
commit 032247ff6e
1 changed files with 3 additions and 0 deletions

View File

@ -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);