[TEST] Handle an IndexLifecycleService that has not started up

This commit is contained in:
Lee Hinman 2018-09-18 14:02:09 -06:00
parent c87cff22b4
commit 11a55d2307
1 changed files with 5 additions and 2 deletions

View File

@ -351,12 +351,15 @@ public class IndexLifecycleInitialisationIT extends ESIntegTestCase {
});
}
public void testPollIntervalUpdate() {
public void testPollIntervalUpdate() throws Exception {
TimeValue pollInterval = TimeValue.timeValueSeconds(randomLongBetween(1, 5));
final String server_1 = internalCluster().startMasterOnlyNode(
Settings.builder().put(LifecycleSettings.LIFECYCLE_POLL_INTERVAL, pollInterval.getStringRep()).build());
IndexLifecycleService indexLifecycleService = internalCluster().getInstance(IndexLifecycleService.class, server_1);
assertThat(indexLifecycleService.getScheduler().jobCount(), equalTo(1));
assertBusy(() -> {
assertNotNull(indexLifecycleService.getScheduler());
assertThat(indexLifecycleService.getScheduler().jobCount(), equalTo(1));
});
{
TimeValueSchedule schedule = (TimeValueSchedule) indexLifecycleService.getScheduledJob().getSchedule();
assertThat(schedule.getInterval(), equalTo(pollInterval));