Skip to content

Commit

Permalink
[7.x] Fix SegmentsStatsTests.testFileExtensionDescriptions (#67166) (#…
Browse files Browse the repository at this point in the history
…67195)

Lucene may create a lock file in this directory as part of creating a directory or writer, and we
should ignore that when checking the list of files against known segment stats.

Resolves #65267
  • Loading branch information
dakrone authored Jan 7, 2021
1 parent 443d308 commit 39a3875
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

public class SegmentsStatsTests extends ESTestCase {

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/65267")
public void testFileExtensionDescriptions() throws Exception {
try (Directory dir = newDirectory()) {
try (IndexWriter w = new IndexWriter(dir, new IndexWriterConfig()
Expand All @@ -64,8 +63,13 @@ public void testFileExtensionDescriptions() throws Exception {

for (String file : dir.listAll()) {
final String extension = IndexFileNames.getExtension(file);
if ("lock".equals(extension)) {
// We should ignore lock files for stats file comparisons
continue;
}
if (extension != null) {
assertTrue(SegmentsStats.FILE_DESCRIPTIONS.get(extension) != null);
assertNotNull("extension [" + extension + "] was not contained in the known segment stats files",
SegmentsStats.FILE_DESCRIPTIONS.get(extension));
}
}
}
Expand Down

0 comments on commit 39a3875

Please sign in to comment.