From 52150ea1b9e80dc104e16c59c4972c38133d5998 Mon Sep 17 00:00:00 2001 From: Stephen Crawford Date: Fri, 9 Jun 2023 10:48:59 -0400 Subject: [PATCH 1/5] add latch.await Signed-off-by: Stephen Crawford --- .../java/org/opensearch/http/SearchRestCancellationIT.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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..5ffad43571001 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 { @@ -162,7 +163,7 @@ public void testAutomaticCancellationMultiSearchDuringFetchPhase() throws Except verifyCancellationDuringFetchPhase(MultiSearchAction.NAME, restRequest); } - void verifyCancellationDuringFetchPhase(String searchAction, Request searchRequest) throws Exception { + void verifyCancellationDuringFetchPhase(String searchAction, Request searchRequest) throws Exception { Map nodeIdToName = readNodesInfo(); List plugins = initBlockFactory(); @@ -183,6 +184,7 @@ public void onFailure(Exception exception) { } }); + latch.await(); awaitForBlock(plugins); cancellable.cancel(); ensureSearchTaskIsCancelled(searchAction, nodeIdToName::get); From 163263f0053be5cf65ec93cbafed9b177fd5f46f Mon Sep 17 00:00:00 2001 From: Stephen Crawford Date: Fri, 9 Jun 2023 10:49:56 -0400 Subject: [PATCH 2/5] remove space Signed-off-by: Stephen Crawford --- .../test/java/org/opensearch/http/SearchRestCancellationIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 5ffad43571001..1a5c2d0db4d3a 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 @@ -163,7 +163,7 @@ public void testAutomaticCancellationMultiSearchDuringFetchPhase() throws Except verifyCancellationDuringFetchPhase(MultiSearchAction.NAME, restRequest); } - void verifyCancellationDuringFetchPhase(String searchAction, Request searchRequest) throws Exception { + void verifyCancellationDuringFetchPhase(String searchAction, Request searchRequest) throws Exception { Map nodeIdToName = readNodesInfo(); List plugins = initBlockFactory(); From 0f43a5d840336b87233a35683ee8b926598acb89 Mon Sep 17 00:00:00 2001 From: Stephen Crawford Date: Fri, 9 Jun 2023 11:14:36 -0400 Subject: [PATCH 3/5] Fix await timing Signed-off-by: Stephen Crawford --- .../java/org/opensearch/http/SearchRestCancellationIT.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 1a5c2d0db4d3a..bc833978ec242 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 @@ -183,8 +183,7 @@ public void onFailure(Exception exception) { latch.countDown(); } }); - - latch.await(); + latch.await(5, TimeUnit.SECONDS); awaitForBlock(plugins); cancellable.cancel(); ensureSearchTaskIsCancelled(searchAction, nodeIdToName::get); From 51f7fa881c5a3cc16787ba348cf0026108a7b06f Mon Sep 17 00:00:00 2001 From: Stephen Crawford Date: Fri, 9 Jun 2023 11:15:11 -0400 Subject: [PATCH 4/5] fix line Signed-off-by: Stephen Crawford --- .../test/java/org/opensearch/http/SearchRestCancellationIT.java | 1 + 1 file changed, 1 insertion(+) 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 bc833978ec242..5c080edcbf961 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 @@ -183,6 +183,7 @@ public void onFailure(Exception exception) { latch.countDown(); } }); + latch.await(5, TimeUnit.SECONDS); awaitForBlock(plugins); cancellable.cancel(); From 50cf7bcf97ae40f7839d9cfec25d4daa1dd8434f Mon Sep 17 00:00:00 2001 From: Stephen Crawford Date: Fri, 9 Jun 2023 11:39:26 -0400 Subject: [PATCH 5/5] shorten await Signed-off-by: Stephen Crawford --- .../test/java/org/opensearch/http/SearchRestCancellationIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 5c080edcbf961..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 @@ -184,7 +184,7 @@ public void onFailure(Exception exception) { } }); - latch.await(5, TimeUnit.SECONDS); + latch.await(2, TimeUnit.SECONDS); awaitForBlock(plugins); cancellable.cancel(); ensureSearchTaskIsCancelled(searchAction, nodeIdToName::get);