Skip to content

Commit 5a76944

Browse files
authored
Fix testCancelFailedSearchWhenPartialResultDisallowed (#64248)
The search request in the test can complete before the "cancelledLatch" is latched if the second shard request is sent after the request was canceled (i.e., the child task is not allowed to start after the parent was canceled). Closes #63976 Relates ##63520
1 parent ef4ea4a commit 5a76944

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

server/src/internalClusterTest/java/org/elasticsearch/search/SearchCancellationIT.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ public void testCancelMultiSearch() throws Exception {
281281
}
282282
}
283283

284-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/63976")
285284
public void testCancelFailedSearchWhenPartialResultDisallowed() throws Exception {
286285
final List<ScriptedBlockPlugin> plugins = initBlockFactory();
287286
int numberOfShards = between(2, 5);
@@ -325,8 +324,12 @@ public void testCancelFailedSearchWhenPartialResultDisallowed() throws Exception
325324
queryLatch.countDown();
326325
assertBusy(() -> {
327326
final List<SearchTask> searchTasks = getSearchTasks();
328-
assertThat(searchTasks, hasSize(1));
329-
assertTrue(searchTasks.get(0).isCancelled());
327+
// The search request can complete before the "cancelledLatch" is latched if the second shard request is sent
328+
// after the request was cancelled (i.e., the child task is not allowed to start after the parent was cancelled).
329+
if (searchTasks.isEmpty() == false) {
330+
assertThat(searchTasks, hasSize(1));
331+
assertTrue(searchTasks.get(0).isCancelled());
332+
}
330333
}, 30, TimeUnit.SECONDS);
331334
} finally {
332335
for (ScriptedBlockPlugin plugin : plugins) {

0 commit comments

Comments
 (0)