From 2a4cc8e3de6673b87d5abb9cd13adbb5612eaf57 Mon Sep 17 00:00:00 2001 From: Stephen Crawford <65832608+scrawfor99@users.noreply.github.com> Date: Tue, 13 Jun 2023 11:43:48 -0400 Subject: [PATCH] Fix flaky test `SearchRestCancellationIT.testAutomaticCancellationMultiSearchDuringFetchPhase` (#7985) * add latch.await Signed-off-by: Stephen Crawford * remove space Signed-off-by: Stephen Crawford * Fix await timing Signed-off-by: Stephen Crawford * fix line Signed-off-by: Stephen Crawford * shorten await Signed-off-by: Stephen Crawford --------- Signed-off-by: Stephen Crawford Signed-off-by: Rishab Nahata --- .../test/java/org/opensearch/http/SearchRestCancellationIT.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qa/smoke-test-http/src/test/java/org/opensearch/http/SearchRestCancellationIT.java b/qa/smoke-test-http/src/test/java/org/opensearch/http/SearchRestCancellationIT.java index 9692ff895b062..4a898d816bbf4 100644 --- a/qa/smoke-test-http/src/test/java/org/opensearch/http/SearchRestCancellationIT.java +++ b/qa/smoke-test-http/src/test/java/org/opensearch/http/SearchRestCancellationIT.java @@ -83,6 +83,7 @@ import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertNoFailures; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.instanceOf; +import static org.opensearch.test.hamcrest.OpenSearchAssertions.awaitLatch; public class SearchRestCancellationIT extends HttpSmokeTestCase { @@ -183,6 +184,7 @@ public void onFailure(Exception exception) { } }); + latch.await(2, TimeUnit.SECONDS); awaitForBlock(plugins); cancellable.cancel(); ensureSearchTaskIsCancelled(searchAction, nodeIdToName::get);