Skip to content

Commit

Permalink
Fix flaky test `SearchRestCancellationIT.testAutomaticCancellationMul…
Browse files Browse the repository at this point in the history
…tiSearchDuringFetchPhase` (opensearch-project#7985)

* add latch.await

Signed-off-by: Stephen Crawford <[email protected]>

* remove space

Signed-off-by: Stephen Crawford <[email protected]>

* Fix await timing

Signed-off-by: Stephen Crawford <[email protected]>

* fix line

Signed-off-by: Stephen Crawford <[email protected]>

* shorten await

Signed-off-by: Stephen Crawford <[email protected]>

---------

Signed-off-by: Stephen Crawford <[email protected]>
Signed-off-by: Rishab Nahata <[email protected]>
  • Loading branch information
stephen-crawford authored and imRishN committed Jun 27, 2023
1 parent bc8eadd commit 2a4cc8e
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -183,6 +184,7 @@ public void onFailure(Exception exception) {
}
});

latch.await(2, TimeUnit.SECONDS);
awaitForBlock(plugins);
cancellable.cancel();
ensureSearchTaskIsCancelled(searchAction, nodeIdToName::get);
Expand Down

0 comments on commit 2a4cc8e

Please sign in to comment.