From 4ef8673fdda8eeb9c75e29676c4d7584cd1e5349 Mon Sep 17 00:00:00 2001 From: Nhat Nguyen Date: Fri, 2 Oct 2020 17:31:12 -0400 Subject: [PATCH] Fix testRestartAfterCompletion (#63211) We need to complete the search before closing the iterator, which internally closes the point in time; otherwise, the search will fail with a missing context error. Closes #62451 --- .../org/elasticsearch/xpack/search/AsyncSearchActionIT.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/x-pack/plugin/async-search/src/internalClusterTest/java/org/elasticsearch/xpack/search/AsyncSearchActionIT.java b/x-pack/plugin/async-search/src/internalClusterTest/java/org/elasticsearch/xpack/search/AsyncSearchActionIT.java index 6839cfd5657..25df836ea74 100644 --- a/x-pack/plugin/async-search/src/internalClusterTest/java/org/elasticsearch/xpack/search/AsyncSearchActionIT.java +++ b/x-pack/plugin/async-search/src/internalClusterTest/java/org/elasticsearch/xpack/search/AsyncSearchActionIT.java @@ -179,6 +179,9 @@ public class AsyncSearchActionIT extends AsyncSearchIntegTestCase { try (SearchResponseIterator it = assertBlockingIterator(indexName, numShards, new SearchSourceBuilder(), 0, 2)) { initial = it.next(); + while (it.hasNext()) { + it.next(); + } } ensureTaskCompletion(initial.getId()); restartTaskNode(initial.getId(), indexName);