Skip to content

Commit 9be2980

Browse files
committed
bound the search tasks creation wait
addresses trinodb#28941 (comment)
1 parent f534c87 commit 9be2980

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

plugin/trino-elasticsearch/src/test/java/io/trino/plugin/elasticsearch/TestBackpressureRestHighLevelClientCancellation.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,11 @@ void testCancelledSqlQueryCancelsEsSearch() throws Exception {
120120
QueryManager queryManager = (
121121
(DistributedQueryRunner) getQueryRunner()
122122
).getCoordinator().getQueryManager();
123-
// Wait for the query to appear in ElasticSearch
124-
while (getSearchTasks().isEmpty()) {
125-
assertThat(future.isDone())
126-
.as("query should still be running")
127-
.isFalse();
123+
// Wait for the query to appear in ElasticSearch (max 2s)
124+
for (int i = 0; i < 20 && getSearchTasks().isEmpty(); i++) {
128125
Thread.sleep(100);
129126
}
127+
assertThat(getSearchTasks()).isNotEmpty();
130128

131129
for (BasicQueryInfo info : queryManager.getQueries()) {
132130
if (!info.getState().isDone()) {

0 commit comments

Comments
 (0)