template installation is async, so use assertBusy
This commit is contained in:
parent
0bfe6de75c
commit
0b06648205
|
@ -37,34 +37,19 @@ import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
public class IngestTemplateTests extends ESSingleNodeTestCase {
|
public class IngestTemplateTests extends ESSingleNodeTestCase {
|
||||||
|
|
||||||
private IngestBootstrapper bootstrapper;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean resetNodeAfterTest() {
|
protected boolean resetNodeAfterTest() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
|
||||||
public void init() {
|
|
||||||
ThreadPool threadPool = mock(ThreadPool.class);
|
|
||||||
when(threadPool.executor(anyString())).thenReturn(Runnable::run);
|
|
||||||
Environment environment = mock(Environment.class);
|
|
||||||
ClusterService clusterService = mock(ClusterService.class);
|
|
||||||
TransportService transportService = mock(TransportService.class);
|
|
||||||
bootstrapper = new IngestBootstrapper(
|
|
||||||
Settings.EMPTY, threadPool, environment, clusterService, transportService, new ProcessorsRegistry()
|
|
||||||
);
|
|
||||||
bootstrapper.setClient(client());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testIngestIndexTemplateIsInstalled() throws Exception {
|
public void testIngestIndexTemplateIsInstalled() throws Exception {
|
||||||
verifyIngestIndexTemplateExist();
|
assertBusy(IngestTemplateTests::verifyIngestIndexTemplateExist);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInstallTemplateAfterItHasBeenRemoved() throws Exception {
|
public void testInstallTemplateAfterItHasBeenRemoved() throws Exception {
|
||||||
verifyIngestIndexTemplateExist();
|
assertBusy(IngestTemplateTests::verifyIngestIndexTemplateExist);
|
||||||
client().admin().indices().prepareDeleteTemplate(IngestBootstrapper.INGEST_INDEX_TEMPLATE_NAME).get();
|
client().admin().indices().prepareDeleteTemplate(IngestBootstrapper.INGEST_INDEX_TEMPLATE_NAME).get();
|
||||||
verifyIngestIndexTemplateExist();
|
assertBusy(IngestTemplateTests::verifyIngestIndexTemplateExist);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void verifyIngestIndexTemplateExist() {
|
private static void verifyIngestIndexTemplateExist() {
|
||||||
|
|
Loading…
Reference in New Issue