mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
[TEST] Fix testReplicaTermIncrementWithConcurrentPrimaryPromotion
The assertion in the test was not broad enough. If the timing is very unlucky, the shard is already promoted to primary before the indexOnReplica even gets to execute. Closes #32645
This commit is contained in:
parent
e641fccfe3
commit
014b2772db
@ -67,6 +67,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import static org.elasticsearch.index.translog.SnapshotMatchers.containsOperationsInAnyOrder;
|
||||
import static org.hamcrest.Matchers.anyOf;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.either;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
@ -261,7 +262,7 @@ public class IndexLevelReplicationTests extends ESIndexLevelReplicationTestCase
|
||||
barrier.await();
|
||||
indexOnReplica(replicationRequest, shards, replica2, newReplica1Term);
|
||||
} catch (IllegalStateException ise) {
|
||||
assertThat(ise.getMessage(), containsString("is too old"));
|
||||
assertThat(ise.getMessage(), either(containsString("is too old")).or(containsString("cannot be a replication target")));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@ -303,7 +304,7 @@ public class IndexLevelReplicationTests extends ESIndexLevelReplicationTestCase
|
||||
indexOnReplica(replicationRequest, shards, replica, primaryPrimaryTerm);
|
||||
successFullyIndexed.set(true);
|
||||
} catch (IllegalStateException ise) {
|
||||
assertThat(ise.getMessage(), containsString("is too old"));
|
||||
assertThat(ise.getMessage(), either(containsString("is too old")).or(containsString("cannot be a replication target")));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user