Skip to content

Commit 496a6bd

Browse files
committed
Randomize primary term
1 parent 56da910 commit 496a6bd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

server/src/test/java/org/elasticsearch/cluster/action/shard/ShardStateActionTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,13 +389,13 @@ public void testCacheRemoteShardFailed() throws Exception {
389389
final String index = "test";
390390
setState(clusterService, ClusterStateCreationUtils.stateWithActivePrimary(index, true, randomInt(5)));
391391
ShardRouting failedShard = getRandomShardRouting(index);
392-
long primaryTerm = clusterService.state().metaData().index(index).primaryTerm(failedShard.id());
393392
boolean markAsStale = randomBoolean();
394393
int numListeners = between(1, 100);
395394
CountDownLatch latch = new CountDownLatch(numListeners);
395+
long primaryTerm = randomLongBetween(1, Long.MAX_VALUE);
396396
for (int i = 0; i < numListeners; i++) {
397397
shardStateAction.remoteShardFailed(failedShard.shardId(), failedShard.allocationId().getId(),
398-
primaryTerm + 1, markAsStale, "test", getSimulatedFailure(), new ShardStateAction.Listener() {
398+
primaryTerm, markAsStale, "test", getSimulatedFailure(), new ShardStateAction.Listener() {
399399
@Override
400400
public void onSuccess() {
401401
latch.countDown();

0 commit comments

Comments
 (0)