Skip to content

Commit 9890589

Browse files
authored
Fix testResyncAfterPrimaryPromotion (#52615)
Adjusts the assertion as we might eagerly clean up translog during resync since #52556 Relates #52556 Closes #52598
1 parent 54fe26e commit 9890589

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
import java.util.stream.Collectors;
7575

7676
import static org.hamcrest.Matchers.anyOf;
77+
import static org.hamcrest.Matchers.either;
7778
import static org.hamcrest.Matchers.empty;
7879
import static org.hamcrest.Matchers.equalTo;
7980
import static org.hamcrest.Matchers.everyItem;
@@ -309,9 +310,7 @@ public void testReplicaRollbackStaleDocumentsInPeerRecovery() throws Exception {
309310
}
310311
}
311312

312-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/52598")
313313
public void testResyncAfterPrimaryPromotion() throws Exception {
314-
// TODO: check translog trimming functionality once rollback is implemented in Lucene (ES trimming is done)
315314
String mappings = "{ \"_doc\": { \"properties\": { \"f\": { \"type\": \"keyword\"} }}}";
316315
try (ReplicationGroup shards = new ReplicationGroup(buildIndexMetaData(2, mappings))) {
317316
shards.startAll();
@@ -378,7 +377,7 @@ public void testResyncAfterPrimaryPromotion() throws Exception {
378377
assertThat(source.source.utf8ToString(), is("{ \"f\": \"normal\"}"));
379378
}
380379
}
381-
assertThat(translogOperations, is(initialDocs + extraDocs));
380+
assertThat(translogOperations, either(equalTo(initialDocs + extraDocs)).or(equalTo(task.getResyncedOperations())));
382381
}
383382
}
384383

0 commit comments

Comments
 (0)