[TEST] Wait for trial license to be generated before running LicensesManagerServiceTests
Many of the tests assume that the trial license has already been generated before the test gets to run. As this is asynchronously triggered upon node startup, however, there is no guarantee that trial license generation has completed before the tests get to execute, leading to null values when checking clusterService.state().metaData().custom(LicensesMetaData.TYPE). Original commit: elastic/x-pack-elasticsearch@d909c9ba95
This commit is contained in:
parent
600aa8fc5d
commit
e3834da05e
|
@ -16,6 +16,7 @@ import org.elasticsearch.test.junit.annotations.TestLogging;
|
|||
import org.elasticsearch.xpack.XPackPlugin;
|
||||
import org.elasticsearch.xpack.XPackSettings;
|
||||
import org.elasticsearch.xpack.XPackSingleNodeTestCase;
|
||||
import org.junit.Before;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
@ -50,6 +51,11 @@ public class LicensesManagerServiceTests extends XPackSingleNodeTestCase {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void waitForTrialLicenseToBeGenerated() throws Exception {
|
||||
assertBusy(() -> assertNotNull(getInstanceFromNode(ClusterService.class).state().metaData().custom(LicensesMetaData.TYPE)));
|
||||
}
|
||||
|
||||
public void testStoreAndGetLicenses() throws Exception {
|
||||
LicenseService licenseService = getInstanceFromNode(LicenseService.class);
|
||||
ClusterService clusterService = getInstanceFromNode(ClusterService.class);
|
||||
|
|
Loading…
Reference in New Issue