TEST: Fix InternalEngine#testAcquireIndexCommit

The acquireIndexCommit was separated into acquireSafeIndexCommit and
acquireLastIndexCommit, however the test was not updated accordingly.

Relates #28271
This commit is contained in:
Nhat Nguyen 2018-02-17 09:48:44 -05:00
parent 4fe1c00a48
commit df07943522
1 changed files with 2 additions and 3 deletions

View File

@ -4349,8 +4349,7 @@ public class InternalEngineTests extends EngineTestCase {
for (int i = 0; i < numDocs; i++) { for (int i = 0; i < numDocs; i++) {
index(engine, i); index(engine, i);
} }
final boolean inSync = randomBoolean(); if (randomBoolean()) {
if (inSync) {
globalCheckpoint.set(numDocs - 1); globalCheckpoint.set(numDocs - 1);
} }
final boolean flushFirst = randomBoolean(); final boolean flushFirst = randomBoolean();
@ -4369,7 +4368,7 @@ public class InternalEngineTests extends EngineTestCase {
engine.flush(); engine.flush();
// check that we can still read the commit that we captured // check that we can still read the commit that we captured
try (IndexReader reader = DirectoryReader.open(snapshot.getIndexCommit())) { try (IndexReader reader = DirectoryReader.open(snapshot.getIndexCommit())) {
assertThat(reader.numDocs(), equalTo(flushFirst && (safeCommit == false || inSync) ? numDocs : 0)); assertThat(reader.numDocs(), equalTo(flushFirst && safeCommit == false ? numDocs : 0));
} }
assertThat(DirectoryReader.listCommits(engine.store.directory()), hasSize(2)); assertThat(DirectoryReader.listCommits(engine.store.directory()), hasSize(2));
snapshot.close(); snapshot.close();