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