diff --git a/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java b/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java index 036fb750432..66be18b8994 100644 --- a/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java +++ b/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java @@ -464,10 +464,10 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest { files.addAll(Arrays.asList(file.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { - return pathname.isFile() && !"write.lock".equals(pathname.getName()) && - (includePerCommitFiles == true // .del and segments_N are per commit files and might change after corruption - || pathname.getName().startsWith("segments") == false - || pathname.getName().endsWith(".del") == false); + if (pathname.isFile() && "write.lock".equals(pathname.getName()) == false) { + return (includePerCommitFiles || isPerSegmentFile(pathname.getName())); + } + return false; // no dirs no write.locks } }))); } @@ -514,6 +514,15 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest { return shardRouting; } + private static final boolean isPerCommitFile(String fileName) { + // .del and segments_N are per commit files and might change after corruption + return fileName.startsWith("segments") || fileName.endsWith(".del"); + } + + private static final boolean isPerSegmentFile(String fileName) { + return isPerCommitFile(fileName) == false; + } + /** * prunes the list of index files such that only the latest del generation files are contained. */