assertBusy in XPackRestIT#awaitCallApi (#54264)
Retries in this method were lost in #45794. This commit reinstates them.
This commit is contained in:
parent
cc981fa377
commit
fc92bf4208
|
@ -36,6 +36,7 @@ import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import static java.util.Collections.emptyList;
|
import static java.util.Collections.emptyList;
|
||||||
|
@ -229,11 +230,14 @@ public class XPackRestIT extends ESClientYamlSuiteTestCase {
|
||||||
CheckedFunction<ClientYamlTestResponse, Boolean, IOException> success,
|
CheckedFunction<ClientYamlTestResponse, Boolean, IOException> success,
|
||||||
Supplier<String> error) {
|
Supplier<String> error) {
|
||||||
try {
|
try {
|
||||||
|
final AtomicReference<ClientYamlTestResponse> response = new AtomicReference<>();
|
||||||
|
assertBusy(() -> {
|
||||||
// The actual method call that sends the API requests returns a Future, but we immediately
|
// The actual method call that sends the API requests returns a Future, but we immediately
|
||||||
// call .get() on it so there's no need for this method to do any other awaiting.
|
// call .get() on it so there's no need for this method to do any other awaiting.
|
||||||
ClientYamlTestResponse response = callApi(apiName, params, bodies, getApiCallHeaders());
|
response.set(callApi(apiName, params, bodies, getApiCallHeaders()));
|
||||||
assertEquals(response.getStatusCode(), HttpStatus.SC_OK);
|
assertEquals(HttpStatus.SC_OK, response.get().getStatusCode());
|
||||||
success.apply(response);
|
});
|
||||||
|
success.apply(response.get());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new IllegalStateException(error.get(), e);
|
throw new IllegalStateException(error.get(), e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue