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:
parent
4fe1c00a48
commit
df07943522
|
@ -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();
|
||||||
|
|
Loading…
Reference in New Issue