|
11 | 11 | import org.elasticsearch.common.bytes.BytesReference; |
12 | 12 | import org.elasticsearch.common.xcontent.XContentHelper; |
13 | 13 | import org.elasticsearch.plugins.Plugin; |
| 14 | +import org.elasticsearch.tasks.TaskInfo; |
14 | 15 | import org.elasticsearch.xcontent.json.JsonXContent; |
15 | 16 | import org.elasticsearch.xpack.core.async.AsyncStopRequest; |
16 | 17 | import org.elasticsearch.xpack.esql.plan.logical.Enrich; |
|
28 | 29 |
|
29 | 30 | import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; |
30 | 31 | import static org.elasticsearch.xpack.esql.EsqlTestUtils.getValuesList; |
| 32 | +import static org.elasticsearch.xpack.esql.action.AbstractCrossClusterTestCase.getDriverTasks; |
31 | 33 | import static org.elasticsearch.xpack.esql.action.EsqlAsyncTestUtils.deleteAsyncId; |
32 | 34 | import static org.elasticsearch.xpack.esql.action.EsqlAsyncTestUtils.startAsyncQuery; |
33 | 35 | import static org.elasticsearch.xpack.esql.action.EsqlAsyncTestUtils.waitForCluster; |
| 36 | +import static org.hamcrest.Matchers.empty; |
34 | 37 | import static org.hamcrest.Matchers.equalTo; |
35 | 38 |
|
36 | 39 | // This tests if enrich after stop works correctly |
@@ -91,6 +94,13 @@ public void testEnrichAfterStop() throws Exception { |
91 | 94 | // Run the stop request |
92 | 95 | var stopRequest = new AsyncStopRequest(asyncExecutionId); |
93 | 96 | var stopAction = client().execute(EsqlAsyncStopAction.INSTANCE, stopRequest); |
| 97 | + // wait until reduce tasks are gone |
| 98 | + assertBusy(() -> { |
| 99 | + List<TaskInfo> tasks = getDriverTasks(client(REMOTE_CLUSTER_2)); |
| 100 | + List<TaskInfo> reduceTasks = tasks.stream().filter(t -> t.description().contains("_LuceneSourceOperator") == false).toList(); |
| 101 | + assertThat(reduceTasks, empty()); |
| 102 | + }); |
| 103 | + |
94 | 104 | // Allow the processing to proceed |
95 | 105 | SimplePauseFieldPlugin.allowEmitting.countDown(); |
96 | 106 |
|
|
0 commit comments