Skip to content

Commit

Permalink
TEST: Fix InternalEngine#testAcquireIndexCommit
Browse files Browse the repository at this point in the history
The acquireIndexCommit was separated into acquireSafeIndexCommit and
acquireLastIndexCommit, however the test was not updated accordingly.

Relates #28271
  • Loading branch information
dnhatn committed Feb 17, 2018
1 parent 4541bd9 commit 4b47b99
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4367,8 +4367,7 @@ public void testAcquireIndexCommit() throws Exception {
for (int i = 0; i < numDocs; i++) {
index(engine, i);
}
final boolean inSync = randomBoolean();
if (inSync) {
if (randomBoolean()) {
globalCheckpoint.set(numDocs - 1);
}
final boolean flushFirst = randomBoolean();
Expand All @@ -4387,7 +4386,7 @@ public void testAcquireIndexCommit() throws Exception {
engine.flush();
// check that we can still read the commit that we captured
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));
snapshot.close();
Expand Down

0 comments on commit 4b47b99

Please sign in to comment.