[BUG] Wait for outstanding requests to complete in LastSuccessfulSett… (#1939)
* [BUG] Wait for outstanding requests to complete in LastSuccessfulSettingsUpdate test Signed-off-by: Suraj Singh <surajrider@gmail.com> * [BUG] Wait for outstanding requests to complete in LastSuccessfulSettingsUpdate test Signed-off-by: Suraj Singh <surajrider@gmail.com>
This commit is contained in:
parent
6eb8f6f307
commit
27e05cc1dc
|
@ -403,14 +403,7 @@ public class ShardIndexingPressureSettingsIT extends OpenSearchIntegTestCase {
|
||||||
secondSuccessFuture = client(coordinatingOnlyNode).bulk(bulkRequest);
|
secondSuccessFuture = client(coordinatingOnlyNode).bulk(bulkRequest);
|
||||||
Thread.sleep(25);
|
Thread.sleep(25);
|
||||||
|
|
||||||
assertBusy(
|
waitForTwoOutstandingRequests(coordinatingShardTracker);
|
||||||
() -> {
|
|
||||||
assertEquals(
|
|
||||||
coordinatingShardTracker.getCoordinatingOperationTracker().getPerformanceTracker().getTotalOutstandingRequests(),
|
|
||||||
2
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// This request breaches the threshold and hence will be rejected
|
// This request breaches the threshold and hence will be rejected
|
||||||
expectThrows(OpenSearchRejectedExecutionException.class, () -> client(coordinatingOnlyNode).bulk(bulkRequest).actionGet());
|
expectThrows(OpenSearchRejectedExecutionException.class, () -> client(coordinatingOnlyNode).bulk(bulkRequest).actionGet());
|
||||||
|
@ -645,6 +638,7 @@ public class ShardIndexingPressureSettingsIT extends OpenSearchIntegTestCase {
|
||||||
IndexingPressureService.class,
|
IndexingPressureService.class,
|
||||||
coordinatingOnlyNode
|
coordinatingOnlyNode
|
||||||
).getShardIndexingPressure().getShardIndexingPressureTracker(shardId);
|
).getShardIndexingPressure().getShardIndexingPressureTracker(shardId);
|
||||||
|
waitForTwoOutstandingRequests(coordinatingShardTracker);
|
||||||
expectThrows(OpenSearchRejectedExecutionException.class, () -> client(coordinatingOnlyNode).bulk(bulkRequest).actionGet());
|
expectThrows(OpenSearchRejectedExecutionException.class, () -> client(coordinatingOnlyNode).bulk(bulkRequest).actionGet());
|
||||||
assertEquals(1, coordinatingShardTracker.getCoordinatingOperationTracker().getRejectionTracker().getTotalRejections());
|
assertEquals(1, coordinatingShardTracker.getCoordinatingOperationTracker().getRejectionTracker().getTotalRejections());
|
||||||
assertEquals(
|
assertEquals(
|
||||||
|
@ -657,6 +651,7 @@ public class ShardIndexingPressureSettingsIT extends OpenSearchIntegTestCase {
|
||||||
ShardIndexingPressureTracker primaryShardTracker = internalCluster().getInstance(IndexingPressureService.class, primaryName)
|
ShardIndexingPressureTracker primaryShardTracker = internalCluster().getInstance(IndexingPressureService.class, primaryName)
|
||||||
.getShardIndexingPressure()
|
.getShardIndexingPressure()
|
||||||
.getShardIndexingPressureTracker(shardId);
|
.getShardIndexingPressureTracker(shardId);
|
||||||
|
waitForTwoOutstandingRequests(primaryShardTracker);
|
||||||
expectThrows(OpenSearchRejectedExecutionException.class, () -> client(primaryName).bulk(bulkRequest).actionGet());
|
expectThrows(OpenSearchRejectedExecutionException.class, () -> client(primaryName).bulk(bulkRequest).actionGet());
|
||||||
assertEquals(1, primaryShardTracker.getCoordinatingOperationTracker().getRejectionTracker().getTotalRejections());
|
assertEquals(1, primaryShardTracker.getCoordinatingOperationTracker().getRejectionTracker().getTotalRejections());
|
||||||
assertEquals(
|
assertEquals(
|
||||||
|
@ -929,6 +924,12 @@ public class ShardIndexingPressureSettingsIT extends OpenSearchIntegTestCase {
|
||||||
.getName();
|
.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void waitForTwoOutstandingRequests(ShardIndexingPressureTracker tracker) throws Exception {
|
||||||
|
assertBusy(
|
||||||
|
() -> { assertEquals(tracker.getCoordinatingOperationTracker().getPerformanceTracker().getTotalOutstandingRequests(), 2); }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private void restartCluster(Settings settings) throws Exception {
|
private void restartCluster(Settings settings) throws Exception {
|
||||||
internalCluster().fullRestart(new InternalTestCluster.RestartCallback() {
|
internalCluster().fullRestart(new InternalTestCluster.RestartCallback() {
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue