[TEST] Fix testConcurrentTermIncreaseOnReplicaShard

This test has a bug that got introduced during the refactoring of #32442. With 2 concurrent term increments,
we can only assert under the operation permit that we are in the correct operation term, not that there is
not already another term bump pending.

Closes #34862
This commit is contained in:
Yannick Welsch 2018-11-05 16:15:19 +01:00
parent 3473217563
commit 4f35eea8fe
1 changed files with 2 additions and 1 deletions

View File

@ -1058,7 +1058,7 @@ public class IndexShardTests extends IndexShardTestCase {
@Override @Override
public void onResponse(Releasable releasable) { public void onResponse(Releasable releasable) {
counter.incrementAndGet(); counter.incrementAndGet();
assertThat(indexShard.getPendingPrimaryTerm(), equalTo(primaryTerm + increment)); assertThat(indexShard.getOperationPrimaryTerm(), equalTo(primaryTerm + increment));
latch.countDown(); latch.countDown();
releasable.close(); releasable.close();
} }
@ -1103,6 +1103,7 @@ public class IndexShardTests extends IndexShardTestCase {
} }
assertThat(indexShard.getPendingPrimaryTerm(), equalTo(primaryTerm + Math.max(firstIncrement, secondIncrement))); assertThat(indexShard.getPendingPrimaryTerm(), equalTo(primaryTerm + Math.max(firstIncrement, secondIncrement)));
assertThat(indexShard.getOperationPrimaryTerm(), equalTo(indexShard.getPendingPrimaryTerm()));
closeShards(indexShard); closeShards(indexShard);
} }