diff --git a/docs/src/test/java/org/elasticsearch/smoketest/DocsClientYamlTestSuiteIT.java b/docs/src/test/java/org/elasticsearch/smoketest/DocsClientYamlTestSuiteIT.java index 069945f1b7474..0773c5b706445 100644 --- a/docs/src/test/java/org/elasticsearch/smoketest/DocsClientYamlTestSuiteIT.java +++ b/docs/src/test/java/org/elasticsearch/smoketest/DocsClientYamlTestSuiteIT.java @@ -104,7 +104,7 @@ protected ClientYamlTestClient initClientYamlTestClient( @Before public void waitForRequirements() throws Exception { - if (isCcrTest()) { + if (isCcrTest() || isGetLicenseTest()) { ESRestTestCase.waitForActiveLicense(adminClient()); } } @@ -175,6 +175,11 @@ protected boolean isCcrTest() { return testName != null && testName.contains("/ccr/"); } + protected boolean isGetLicenseTest() { + String testName = getTestName(); + return testName != null && (testName.contains("/get-license/") || testName.contains("\\get-license\\")); + } + /** * Compares the results of running two analyzers against many random * strings. The goal is to figure out if two anlayzers are "the same" by diff --git a/x-pack/plugin/security/qa/basic-enable-security/src/test/java/org/elasticsearch/xpack/security/EnableSecurityOnBasicLicenseIT.java b/x-pack/plugin/security/qa/basic-enable-security/src/test/java/org/elasticsearch/xpack/security/EnableSecurityOnBasicLicenseIT.java index fa64a89f2f633..f3ce68e85a0fe 100644 --- a/x-pack/plugin/security/qa/basic-enable-security/src/test/java/org/elasticsearch/xpack/security/EnableSecurityOnBasicLicenseIT.java +++ b/x-pack/plugin/security/qa/basic-enable-security/src/test/java/org/elasticsearch/xpack/security/EnableSecurityOnBasicLicenseIT.java @@ -97,10 +97,16 @@ private String getIndices() throws IOException { return EntityUtils.toString(response.getEntity()); } - private void checkBasicLicenseType() throws IOException { - Map license = getAsMap("/_license"); - assertThat(license, notNullValue()); - assertThat(ObjectPath.evaluate(license, "license.type"), equalTo("basic")); + private void checkBasicLicenseType() throws Exception { + assertBusy(() -> { + try { + Map license = getAsMap("/_license"); + assertThat(license, notNullValue()); + assertThat(ObjectPath.evaluate(license, "license.type"), equalTo("basic")); + } catch (ResponseException e) { + throw new AssertionError(e); + } + }); } private void checkSecurityStatus(boolean expectEnabled) throws IOException { diff --git a/x-pack/plugin/security/qa/security-basic/src/test/java/org/elasticsearch/xpack/security/SecurityWithBasicLicenseIT.java b/x-pack/plugin/security/qa/security-basic/src/test/java/org/elasticsearch/xpack/security/SecurityWithBasicLicenseIT.java index 98f92c750951c..142f0e0ba960c 100644 --- a/x-pack/plugin/security/qa/security-basic/src/test/java/org/elasticsearch/xpack/security/SecurityWithBasicLicenseIT.java +++ b/x-pack/plugin/security/qa/security-basic/src/test/java/org/elasticsearch/xpack/security/SecurityWithBasicLicenseIT.java @@ -77,10 +77,12 @@ private void revertTrial() throws IOException { client().performRequest(new Request("POST", "/_license/start_basic?acknowledge=true")); } - private void checkLicenseType(String type) throws IOException { - Map license = getAsMap("/_license"); - assertThat(license, notNullValue()); - assertThat(ObjectPath.evaluate(license, "license.type"), equalTo(type)); + private void checkLicenseType(String type) throws Exception { + assertBusy(() -> { + Map license = getAsMap("/_license"); + assertThat(license, notNullValue()); + assertThat(ObjectPath.evaluate(license, "license.type"), equalTo(type)); + }); } private void checkSecurityEnabled(boolean allowAllRealms) throws IOException { diff --git a/x-pack/plugin/security/qa/tls-basic/src/test/java/org/elasticsearch/xpack/security/TlsWithBasicLicenseIT.java b/x-pack/plugin/security/qa/tls-basic/src/test/java/org/elasticsearch/xpack/security/TlsWithBasicLicenseIT.java index 5477dd638f9bf..805cecf21d99a 100644 --- a/x-pack/plugin/security/qa/tls-basic/src/test/java/org/elasticsearch/xpack/security/TlsWithBasicLicenseIT.java +++ b/x-pack/plugin/security/qa/tls-basic/src/test/java/org/elasticsearch/xpack/security/TlsWithBasicLicenseIT.java @@ -60,9 +60,11 @@ protected Settings restClientSettings() { } public void testWithBasicLicense() throws Exception { - checkLicenseType("basic"); - checkSSLEnabled(); - checkCertificateAPI(); + assertBusy(() -> { + checkLicenseType("basic"); + checkSSLEnabled(); + checkCertificateAPI(); + }); } public void testWithTrialLicense() throws Exception {