Fix FsRepositoryTests.testSnapshotAndRestore (#42925) (#43420)

* The commit generation can be 3 or 2 here -> fixed by checking the actual generation on the second commit instead of hard coding 2
* Closes #42905
This commit is contained in:
Armin Braun 2019-06-20 16:36:40 +02:00 committed by GitHub
parent 7d1983a7e3
commit 39fef8379b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -75,7 +75,6 @@ import static java.util.Collections.emptySet;
public class FsRepositoryTests extends ESTestCase {
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/42905")
public void testSnapshotAndRestore() throws IOException, InterruptedException {
ThreadPool threadPool = new TestThreadPool(getClass().getSimpleName());
try (Directory directory = newDirectory()) {
@ -149,7 +148,7 @@ public class FsRepositoryTests extends ESTestCase {
secondState.getIndex().fileDetails().stream().filter(f -> f.reused() == false).collect(Collectors.toList());
Collections.sort(recoveredFiles, Comparator.comparing(RecoveryState.File::name));
assertTrue(recoveredFiles.get(0).name(), recoveredFiles.get(0).name().endsWith(".liv"));
assertTrue(recoveredFiles.get(1).name(), recoveredFiles.get(1).name().endsWith("segments_2"));
assertTrue(recoveredFiles.get(1).name(), recoveredFiles.get(1).name().endsWith("segments_" + incIndexCommit.getGeneration()));
} finally {
terminate(threadPool);
}