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) (opensearch-project#8042)

* add latch.await



* remove space



* Fix await timing



* fix line



* shorten await



---------


(cherry picked from commit df517a6)

Signed-off-by: Stephen Crawford <[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
2 people authored and gaiksaya committed Jun 26, 2023
1 parent 0147136 commit 74380cc
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 74380cc

Please sign in to comment.