[TEST] make LuceneTest extraFS proof

This commit is contained in:
Simon Willnauer 2015-05-04 10:33:47 +02:00
parent 9e82d3e7b9
commit fe7d018f0c
1 changed files with 6 additions and 3 deletions

View File

@ -144,8 +144,11 @@ public class LuceneTest extends ElasticsearchTestCase {
} }
Lucene.cleanLuceneIndex(dir); Lucene.cleanLuceneIndex(dir);
if (dir.listAll().length > 0) { if (dir.listAll().length > 0) {
assertEquals(dir.listAll().length, 1); for (String file : dir.listAll()) {
assertEquals(dir.listAll()[0], "write.lock"); if (file.startsWith("extra") == false) {
assertEquals(file, "write.lock");
}
}
} }
dir.close(); dir.close();
} }
@ -200,7 +203,7 @@ public class LuceneTest extends ElasticsearchTestCase {
assertEquals(s.search(new TermQuery(new Term("id", "4")), 1).totalHits, 0); assertEquals(s.search(new TermQuery(new Term("id", "4")), 1).totalHits, 0);
for (String file : dir.listAll()) { for (String file : dir.listAll()) {
assertFalse("unexpected file: " + file, file.equals("segments_3") || file.startsWith("_2")); assertFalse("unexpected file: " + file, file.equals("segments_3") || file.startsWith("_2") || file.startsWith("extra"));
} }
open.close(); open.close();
dir.close(); dir.close();