Skip to content

Commit dc2edc9

Browse files
committed
Fix sporadic failures in AsyncSearchActionTests (take 2)
This change removes the need to always get a new version when iterating on an async search. This is needed since we cannot guarantee that shards will be queried exactly in order. Relates #53360
1 parent e1eebea commit dc2edc9

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

x-pack/plugin/async-search/src/test/java/org/elasticsearch/xpack/search/AsyncSearchIntegTestCase.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ protected SearchResponseIterator assertBlockingIterator(String indexName,
184184

185185
return new SearchResponseIterator() {
186186
private AsyncSearchResponse response = initial;
187-
private int lastVersion = initial.getVersion();
188187
private int shardIndex = 0;
189188
private boolean isFirst = true;
190189
private int shardFailures = 0;
@@ -219,15 +218,9 @@ private AsyncSearchResponse doNext() throws Exception {
219218
}
220219
shardLatchArray[shardIndex++].countDown();
221220
}
222-
assertBusy(() -> {
223-
AsyncSearchResponse newResp = client().execute(GetAsyncSearchAction.INSTANCE,
224-
new GetAsyncSearchAction.Request(response.getId())
225-
.setWaitForCompletion(TimeValue.timeValueMillis(10))).get();
226-
atomic.set(newResp);
227-
assertNotEquals(lastVersion, newResp.getVersion());
228-
});
229-
AsyncSearchResponse newResponse = atomic.get();
230-
lastVersion = newResponse.getVersion();
221+
AsyncSearchResponse newResponse = client().execute(GetAsyncSearchAction.INSTANCE,
222+
new GetAsyncSearchAction.Request(response.getId())
223+
.setWaitForCompletion(TimeValue.timeValueMillis(10))).get();
231224

232225
if (newResponse.isRunning()) {
233226
assertThat(newResponse.status(), equalTo(RestStatus.OK));

0 commit comments

Comments
 (0)