|
@@ -33,6 +33,7 @@ import java.util.Arrays;
|
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
import java.util.function.Supplier;
|
|
|
|
|
@@ -100,7 +101,8 @@ public abstract class AbstractXPackRestTest extends ESClientYamlSuiteTestCase {
|
|
|
Map.of(),
|
|
|
List.of(),
|
|
|
response -> true,
|
|
|
- () -> "Exception when waiting for initial license to be generated"
|
|
|
+ () -> "Exception when waiting for initial license to be generated",
|
|
|
+ 30 // longer wait time to accommodate slow-running CI release builds
|
|
|
);
|
|
|
}
|
|
|
|
|
@@ -141,6 +143,17 @@ public abstract class AbstractXPackRestTest extends ESClientYamlSuiteTestCase {
|
|
|
List<Map<String, Object>> bodies,
|
|
|
CheckedFunction<ClientYamlTestResponse, Boolean, IOException> success,
|
|
|
Supplier<String> error
|
|
|
+ ) {
|
|
|
+ awaitCallApi(apiName, params, bodies, success, error, 10);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void awaitCallApi(
|
|
|
+ String apiName,
|
|
|
+ Map<String, String> params,
|
|
|
+ List<Map<String, Object>> bodies,
|
|
|
+ CheckedFunction<ClientYamlTestResponse, Boolean, IOException> success,
|
|
|
+ Supplier<String> error,
|
|
|
+ long maxWaitTimeInSeconds
|
|
|
) {
|
|
|
try {
|
|
|
final AtomicReference<ClientYamlTestResponse> response = new AtomicReference<>();
|
|
@@ -155,7 +168,7 @@ public abstract class AbstractXPackRestTest extends ESClientYamlSuiteTestCase {
|
|
|
// rather than a runtime failure (which terminates the loop)
|
|
|
throw new AssertionError("Failed to call API " + apiName, e);
|
|
|
}
|
|
|
- });
|
|
|
+ }, maxWaitTimeInSeconds, TimeUnit.SECONDS);
|
|
|
success.apply(response.get());
|
|
|
} catch (Exception e) {
|
|
|
throw new IllegalStateException(error.get(), e);
|