Skip to content

Commit 87e7656

Browse files
committed
Fix testResyncAfterPrimaryPromotion (#52615)
Adjusts the assertion as we might eagerly clean up translog during resync since #52556 Relates #52556 Closes #52598
1 parent 5aa612c commit 87e7656

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

server/src/test/java/org/elasticsearch/index/replication/RecoveryDuringReplicationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
import java.util.stream.Collectors;
7878

7979
import static org.hamcrest.Matchers.anyOf;
80+
import static org.hamcrest.Matchers.either;
8081
import static org.hamcrest.Matchers.empty;
8182
import static org.hamcrest.Matchers.equalTo;
8283
import static org.hamcrest.Matchers.everyItem;
@@ -378,7 +379,6 @@ public void testReplicaRollbackStaleDocumentsInPeerRecovery() throws Exception {
378379
}
379380

380381
public void testResyncAfterPrimaryPromotion() throws Exception {
381-
// TODO: check translog trimming functionality once rollback is implemented in Lucene (ES trimming is done)
382382
Map<String, String> mappings =
383383
Collections.singletonMap("type", "{ \"type\": { \"properties\": { \"f\": { \"type\": \"keyword\"} }}}");
384384
try (ReplicationGroup shards = new ReplicationGroup(buildIndexMetaData(2, mappings))) {
@@ -446,7 +446,7 @@ public void testResyncAfterPrimaryPromotion() throws Exception {
446446
assertThat(source.source.utf8ToString(), is("{ \"f\": \"normal\"}"));
447447
}
448448
}
449-
assertThat(translogOperations, is(initialDocs + extraDocs));
449+
assertThat(translogOperations, either(equalTo(initialDocs + extraDocs)).or(equalTo(task.getResyncedOperations())));
450450
}
451451
}
452452

0 commit comments

Comments
 (0)