Fix testResyncAfterPrimaryPromotion (#52615)

Adjusts the assertion as we might eagerly clean up translog during resync since #52556

Relates #52556
Closes #52598
This commit is contained in:
Nhat Nguyen 2020-02-21 03:22:38 -05:00
parent 5aa612c275
commit 87e765609e
1 changed files with 2 additions and 2 deletions

View File

@ -77,6 +77,7 @@ import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import static org.hamcrest.Matchers.anyOf;
import static org.hamcrest.Matchers.either;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.everyItem;
@ -378,7 +379,6 @@ public class RecoveryDuringReplicationTests extends ESIndexLevelReplicationTestC
}
public void testResyncAfterPrimaryPromotion() throws Exception {
// TODO: check translog trimming functionality once rollback is implemented in Lucene (ES trimming is done)
Map<String, String> mappings =
Collections.singletonMap("type", "{ \"type\": { \"properties\": { \"f\": { \"type\": \"keyword\"} }}}");
try (ReplicationGroup shards = new ReplicationGroup(buildIndexMetaData(2, mappings))) {
@ -446,7 +446,7 @@ public class RecoveryDuringReplicationTests extends ESIndexLevelReplicationTestC
assertThat(source.source.utf8ToString(), is("{ \"f\": \"normal\"}"));
}
}
assertThat(translogOperations, is(initialDocs + extraDocs));
assertThat(translogOperations, either(equalTo(initialDocs + extraDocs)).or(equalTo(task.getResyncedOperations())));
}
}