add assertBusy to testEmptyGetLicense as trial license is added async

Original commit: elastic/x-pack-elasticsearch@8dea3c54f9
This commit is contained in:
Boaz Leskes 2016-05-31 09:48:53 +02:00
parent 2a7e2a6cd6
commit fc5edc242d
1 changed files with 13 additions and 5 deletions

View File

@ -58,11 +58,19 @@ public class LicensesTransportTests extends ESSingleNodeTestCase {
}
public void testEmptyGetLicense() throws Exception {
final ActionFuture<GetLicenseResponse> getLicenseFuture =
new GetLicenseRequestBuilder(client().admin().cluster(), GetLicenseAction.INSTANCE).execute();
final GetLicenseResponse getLicenseResponse = getLicenseFuture.get();
assertNotNull(getLicenseResponse.license());
assertThat(getLicenseResponse.license().operationMode(), equalTo(License.OperationMode.TRIAL));
// trail license is added async, we should wait for it
assertBusy(() -> {
try {
final ActionFuture<GetLicenseResponse> getLicenseFuture =
new GetLicenseRequestBuilder(client().admin().cluster(), GetLicenseAction.INSTANCE).execute();
final GetLicenseResponse getLicenseResponse;
getLicenseResponse = getLicenseFuture.get();
assertNotNull(getLicenseResponse.license());
assertThat(getLicenseResponse.license().operationMode(), equalTo(License.OperationMode.TRIAL));
} catch (Exception e) {
throw new RuntimeException("unexpected exception", e);
}
});
}
public void testPutLicense() throws Exception {