since ingest is part of core the ingest template always gets installed, so the assumptions this test had had to be updated
This commit is contained in:
parent
4dca3cb38f
commit
7e56f65939
|
@ -57,43 +57,16 @@ public class IngestTemplateTests extends ESSingleNodeTestCase {
|
||||||
bootstrapper.setClient(client());
|
bootstrapper.setClient(client());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInstallIndexTemplate() throws Exception {
|
public void testIngestIndexTemplateIsInstalled() throws Exception {
|
||||||
verifyNoIndexTemplates();
|
|
||||||
ClusterState clusterState = client().admin().cluster().prepareState().get().getState();
|
|
||||||
bootstrapper.clusterChanged(new ClusterChangedEvent("test", clusterState, clusterState));
|
|
||||||
verifyIngestIndexTemplateExist();
|
verifyIngestIndexTemplateExist();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInstallTemplateAfterItHasBeenRemoved() throws Exception {
|
public void testInstallTemplateAfterItHasBeenRemoved() throws Exception {
|
||||||
verifyNoIndexTemplates();
|
|
||||||
ClusterState clusterState = client().admin().cluster().prepareState().get().getState();
|
|
||||||
bootstrapper.clusterChanged(new ClusterChangedEvent("test", clusterState, clusterState));
|
|
||||||
verifyIngestIndexTemplateExist();
|
verifyIngestIndexTemplateExist();
|
||||||
|
|
||||||
client().admin().indices().prepareDeleteTemplate(IngestBootstrapper.INGEST_INDEX_TEMPLATE_NAME).get();
|
client().admin().indices().prepareDeleteTemplate(IngestBootstrapper.INGEST_INDEX_TEMPLATE_NAME).get();
|
||||||
verifyNoIndexTemplates();
|
|
||||||
|
|
||||||
clusterState = client().admin().cluster().prepareState().get().getState();
|
|
||||||
bootstrapper.clusterChanged(new ClusterChangedEvent("test", clusterState, clusterState));
|
|
||||||
verifyIngestIndexTemplateExist();
|
verifyIngestIndexTemplateExist();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDoNotInstallTemplateBecauseIngestIndexTemplateAlreadyExists() throws Exception {
|
|
||||||
// add an empty template and check that it doesn't get overwritten:
|
|
||||||
client().admin().indices().preparePutTemplate(IngestBootstrapper.INGEST_INDEX_TEMPLATE_NAME).setTemplate(".ingest").get();
|
|
||||||
GetIndexTemplatesResponse response = client().admin().indices().prepareGetTemplates(IngestBootstrapper.INGEST_INDEX_TEMPLATE_NAME).get();
|
|
||||||
assertThat(response.getIndexTemplates().size(), Matchers.equalTo(1));
|
|
||||||
assertThat(response.getIndexTemplates().get(0).getOrder(), Matchers.equalTo(0));
|
|
||||||
|
|
||||||
ClusterState clusterState = client().admin().cluster().prepareState().get().getState();
|
|
||||||
bootstrapper.clusterChanged(new ClusterChangedEvent("test", clusterState, clusterState));
|
|
||||||
|
|
||||||
response = client().admin().indices().prepareGetTemplates(IngestBootstrapper.INGEST_INDEX_TEMPLATE_NAME).get();
|
|
||||||
assertThat(response.getIndexTemplates().size(), Matchers.equalTo(1));
|
|
||||||
assertThat("The empty index template shouldn't get overwritten", response.getIndexTemplates().get(0).getOrder(), Matchers.equalTo(0));
|
|
||||||
assertThat("The empty index template shouldn't get overwritten", response.getIndexTemplates().get(0).getMappings().size(), Matchers.equalTo(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void verifyIngestIndexTemplateExist() {
|
private static void verifyIngestIndexTemplateExist() {
|
||||||
GetIndexTemplatesResponse response = client().admin().indices().prepareGetTemplates(IngestBootstrapper.INGEST_INDEX_TEMPLATE_NAME).get();
|
GetIndexTemplatesResponse response = client().admin().indices().prepareGetTemplates(IngestBootstrapper.INGEST_INDEX_TEMPLATE_NAME).get();
|
||||||
assertThat(response.getIndexTemplates().size(), Matchers.equalTo(1));
|
assertThat(response.getIndexTemplates().size(), Matchers.equalTo(1));
|
||||||
|
@ -103,9 +76,4 @@ public class IngestTemplateTests extends ESSingleNodeTestCase {
|
||||||
assertThat(response.getIndexTemplates().get(0).getMappings().get(PipelineStore.TYPE), Matchers.notNullValue());
|
assertThat(response.getIndexTemplates().get(0).getMappings().get(PipelineStore.TYPE), Matchers.notNullValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void verifyNoIndexTemplates() {
|
|
||||||
GetIndexTemplatesResponse response = client().admin().indices().prepareGetTemplates().get();
|
|
||||||
assertThat(response.getIndexTemplates().size(), Matchers.equalTo(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue