Make sure that the alerts templates get applied and disabled test template since it conflicts with the alerts templates.
Original commit: elastic/x-pack-elasticsearch@ddd178da78
This commit is contained in:
parent
e4d10c58a9
commit
3965cb194c
|
@ -64,7 +64,7 @@ public class TemplateHelper extends AbstractComponent {
|
|||
|
||||
IndexTemplateMetaData templateMetaData = state.metaData().templates().get(templateName);
|
||||
if (templateMetaData != null) {
|
||||
int foundVersion = templateMetaData.getSettings().getAsInt("alerts.template_version", -1);
|
||||
int foundVersion = templateMetaData.getSettings().getAsInt("index.alerts.template_version", -1);
|
||||
if (foundVersion < 0) {
|
||||
logger.warn("found an existing index template [{}] but couldn't extract it's version. leaving it as is.", templateName);
|
||||
return;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"template": ".alert_history*",
|
||||
"order": 0,
|
||||
"order": 2147483647,
|
||||
"settings": {
|
||||
"number_of_shards": 1,
|
||||
"number_of_replicas": 1,
|
||||
"alerts.template_version": 1
|
||||
"index.number_of_shards": 1,
|
||||
"index.number_of_replicas": 1,
|
||||
"index.alerts.template_version": 1
|
||||
},
|
||||
"mappings": {
|
||||
"alerthistory": {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"template": ".alerts",
|
||||
"order": 0,
|
||||
"order": 2147483647,
|
||||
"settings": {
|
||||
"number_of_shards": 1,
|
||||
"number_of_replicas": 1,
|
||||
"alerts.template_version": 1
|
||||
"index.number_of_shards": 1,
|
||||
"index.number_of_replicas": 1,
|
||||
"index.alerts.template_version": 1
|
||||
},
|
||||
"mappings": {
|
||||
"alert": {
|
||||
|
|
|
@ -43,7 +43,7 @@ import static org.hamcrest.core.IsNot.not;
|
|||
|
||||
/**
|
||||
*/
|
||||
@ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.SUITE, numClientNodes = 0, transportClientRatio = 0)
|
||||
@ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.SUITE, numClientNodes = 0, transportClientRatio = 0, randomDynamicTemplates = false)
|
||||
public abstract class AbstractAlertingTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
@Override
|
||||
|
@ -55,6 +55,10 @@ public abstract class AbstractAlertingTests extends ElasticsearchIntegrationTest
|
|||
.build();
|
||||
}
|
||||
|
||||
public boolean randomizeNumberOfShardsAndReplicas() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TestCluster buildTestCluster(Scope scope, long seed) throws IOException {
|
||||
// This overwrites the wipe logic of the test cluster to not remove the alerts and alerthistory templates. By default all templates are removed
|
||||
|
|
|
@ -56,7 +56,6 @@ public class BootStrapTest extends AbstractAlertingTests {
|
|||
@Test
|
||||
public void testBootStrapHistory() throws Exception {
|
||||
ensureAlertingStarted();
|
||||
internalTestCluster().ensureAtLeastNumDataNodes(2);
|
||||
|
||||
AlertsStatsResponse response = alertClient().prepareAlertsStats().get();
|
||||
assertTrue(response.isAlertActionManagerStarted());
|
||||
|
@ -86,7 +85,6 @@ public class BootStrapTest extends AbstractAlertingTests {
|
|||
.setSource(XContentFactory.jsonBuilder().value(entry))
|
||||
.get();
|
||||
assertTrue(indexResponse.isCreated());
|
||||
client().admin().indices().prepareRefresh(actionHistoryIndex).get();
|
||||
|
||||
stopAlerting();
|
||||
startAlerting();
|
||||
|
|
|
@ -31,7 +31,7 @@ import static org.hamcrest.core.Is.is;
|
|||
|
||||
/**
|
||||
*/
|
||||
@ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST, numClientNodes = 0, transportClientRatio = 0, numDataNodes = 0)
|
||||
@ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST, numClientNodes = 0, transportClientRatio = 0, randomDynamicTemplates = false, numDataNodes = 0)
|
||||
public class NoMasterNodeTests extends AbstractAlertingTests {
|
||||
|
||||
private ClusterDiscoveryConfiguration.UnicastZen config;
|
||||
|
|
|
@ -25,7 +25,7 @@ import static org.hamcrest.core.IsEqual.equalTo;
|
|||
|
||||
/**
|
||||
*/
|
||||
@ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST, numClientNodes = 0, transportClientRatio = 0)
|
||||
@ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST, numClientNodes = 0, transportClientRatio = 0, randomDynamicTemplates = false)
|
||||
public class AlertStatsTests extends AbstractAlertingTests {
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue