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 142f0e0ba960c..1d6caab98d243 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 @@ -79,9 +79,13 @@ private void revertTrial() throws IOException { private void checkLicenseType(String type) throws Exception { assertBusy(() -> { - Map license = getAsMap("/_license"); - assertThat(license, notNullValue()); - assertThat(ObjectPath.evaluate(license, "license.type"), equalTo(type)); + try { + Map license = getAsMap("/_license"); + assertThat(license, notNullValue()); + assertThat(ObjectPath.evaluate(license, "license.type"), equalTo(type)); + } catch (ResponseException e) { + throw new AssertionError(e); + } }); } 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 805cecf21d99a..9f2284a3624a4 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 @@ -7,6 +7,7 @@ import org.elasticsearch.client.Request; import org.elasticsearch.client.Response; +import org.elasticsearch.client.ResponseException; import org.elasticsearch.common.io.PathUtils; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.rest.ESRestTestCase; @@ -60,11 +61,9 @@ protected Settings restClientSettings() { } public void testWithBasicLicense() throws Exception { - assertBusy(() -> { - checkLicenseType("basic"); - checkSSLEnabled(); - checkCertificateAPI(); - }); + checkLicenseType("basic"); + checkSSLEnabled(); + checkCertificateAPI(); } public void testWithTrialLicense() throws Exception { @@ -87,10 +86,17 @@ 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(() -> { + try { + Map license = getAsMap("/_license"); + assertThat(license, notNullValue()); + assertThat(ObjectPath.evaluate(license, "license.type"), equalTo(type)); + } catch (ResponseException e) { + throw new AssertionError(e); + } + }); + } private void checkSSLEnabled() throws IOException {