Skip to content

Commit

Permalink
Fix flaky ShardIndexingPressureConcurrentExecutionTests (#5439) (#5450)
Browse files Browse the repository at this point in the history
Add conditional check on assertNull to fix flaky tests.

Signed-off-by: Rishikesh1159 <[email protected]>
(cherry picked from commit 0bd3141)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

Signed-off-by: Rishikesh1159 <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent f7e2d8e commit 1be8521
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,13 @@ public void testCoordinatingPrimaryThreadedUpdateToShardLimitsAndRejections() th

nodeStats = shardIndexingPressure.stats();
IndexingPressurePerShardStats shardStoreStats = shardIndexingPressure.shardStats().getIndexingPressureShardStats(shardId1);
assertNull(shardStoreStats);
// If rejection count equals NUM_THREADS that means rejections happened until the last request, then we'll get shardStoreStats which
// was updated on the last request. In other cases, the shardStoreStats simply moves to the cold store and null is returned.
if (rejectionCount.get() == NUM_THREADS) {
assertEquals(10, shardStoreStats.getCurrentPrimaryAndCoordinatingLimits());
} else {
assertNull(shardStoreStats);
}
shardStats = shardIndexingPressure.coldStats();
if (randomBoolean) {
assertEquals(rejectionCount.get(), nodeStats.getCoordinatingRejections());
Expand Down Expand Up @@ -331,7 +337,13 @@ public void testReplicaThreadedUpdateToShardLimitsAndRejections() throws Excepti
assertEquals(0, nodeStats.getCurrentReplicaBytes());

IndexingPressurePerShardStats shardStoreStats = shardIndexingPressure.shardStats().getIndexingPressureShardStats(shardId1);
assertNull(shardStoreStats);
// If rejection count equals NUM_THREADS that means rejections happened until the last request, then we'll get shardStoreStats which
// was updated on the last request. In other cases, the shardStoreStats simply moves to the cold store and null is returned.
if (rejectionCount.get() == NUM_THREADS) {
assertEquals(15, shardStoreStats.getCurrentReplicaLimits());
} else {
assertNull(shardStoreStats);
}

shardStats = shardIndexingPressure.coldStats();
assertEquals(rejectionCount.get(), shardStats.getIndexingPressureShardStats(shardId1).getReplicaNodeLimitsBreachedRejections());
Expand Down

0 comments on commit 1be8521

Please sign in to comment.