Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected ClientYamlTestClient initClientYamlTestClient(

@Before
public void waitForRequirements() throws Exception {
if (isCcrTest()) {
if (isCcrTest() || isGetLicenseTest()) {
ESRestTestCase.waitForActiveLicense(adminClient());
}
}
Expand Down Expand Up @@ -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\\"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this need to support \\ but ccr doesn't?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My guess is that ccr tests do not run on Windows? There are other similar methods in this file, e.g. isMachineLearningTest, isTransformTest and they all check for the backslash'd variant. The CI does have machine learning specific jobs so I think they are justified.

For license check, I decided to add it because we do have multijob-windows-compatibility jobs. I am not completely sure that these jobs run the license check. But it's easy to add so I just did it.

}

/**
* Compares the results of running two analyzers against many random
* strings. The goal is to figure out if two anlayzers are "the same" by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,16 @@ private String getIndices() throws IOException {
return EntityUtils.toString(response.getEntity());
}

private void checkBasicLicenseType() throws IOException {
Map<String, Object> license = getAsMap("/_license");
assertThat(license, notNullValue());
assertThat(ObjectPath.evaluate(license, "license.type"), equalTo("basic"));
private void checkBasicLicenseType() throws Exception {
assertBusy(() -> {
try {
Map<String, Object> 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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, Object> license = getAsMap("/_license");
assertThat(license, notNullValue());
assertThat(ObjectPath.evaluate(license, "license.type"), equalTo(type));
private void checkLicenseType(String type) throws Exception {
assertBusy(() -> {
Map<String, Object> license = getAsMap("/_license");
assertThat(license, notNullValue());
assertThat(ObjectPath.evaluate(license, "license.type"), equalTo(type));
});
}

private void checkSecurityEnabled(boolean allowAllRealms) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down