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
This commit is contained in:
jimczi 2020-03-11 18:17:00 +01:00
parent e1eebea846
commit dc2edc97f0
1 changed files with 3 additions and 10 deletions

View File

@ -184,7 +184,6 @@ public abstract class AsyncSearchIntegTestCase extends ESIntegTestCase {
return new SearchResponseIterator() {
private AsyncSearchResponse response = initial;
private int lastVersion = initial.getVersion();
private int shardIndex = 0;
private boolean isFirst = true;
private int shardFailures = 0;
@ -219,15 +218,9 @@ public abstract class AsyncSearchIntegTestCase extends ESIntegTestCase {
}
shardLatchArray[shardIndex++].countDown();
}
assertBusy(() -> {
AsyncSearchResponse newResp = client().execute(GetAsyncSearchAction.INSTANCE,
new GetAsyncSearchAction.Request(response.getId())
.setWaitForCompletion(TimeValue.timeValueMillis(10))).get();
atomic.set(newResp);
assertNotEquals(lastVersion, newResp.getVersion());
});
AsyncSearchResponse newResponse = atomic.get();
lastVersion = newResponse.getVersion();
AsyncSearchResponse newResponse = client().execute(GetAsyncSearchAction.INSTANCE,
new GetAsyncSearchAction.Request(response.getId())
.setWaitForCompletion(TimeValue.timeValueMillis(10))).get();
if (newResponse.isRunning()) {
assertThat(newResponse.status(), equalTo(RestStatus.OK));