From 86364f829040909734e608978d5a0eaa231944ef Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Tue, 29 May 2018 14:46:35 -0400 Subject: [PATCH] QA: Preserve templates and snapshot on upgrades Monitoring wasn't consistently creating its templates when the rolling upgrade test case was running against the zip distribution. It looked like the templates were being removed as soon as they were created: ``` [2018-05-29T15:33:38,311][DEBUG][o.e.c.s.ClusterApplierService] [node-0] processing [apply cluster state (from master [master {node-0}{9cTSjfGtQyeoSNxIRF_BdQ}{SI9wsZjeQUKAAhBavEnOPQ}{127.0.0.1}{127.0.0.1:45985}{ml.machine_memory=33651564544, xpack.installed=true, testattr=test, ml.max_open_jobs=20, ml.enabled=true} committed version [160] source [create-index-template [.monitoring-kibana], cause [api]]])]: took [11ms] done applying updated cluster state (version: 160, uuid: z0cPB7DkQceXohOOzYgRRg) [2018-05-29T15:33:40,752][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node-0] removing template [.monitoring-es] [2018-05-29T15:33:40,752][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node-0] removing template [.monitoring-alerts] [2018-05-29T15:33:40,752][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node-0] removing template [.monitoring-kibana] [2018-05-29T15:33:40,752][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node-0] removing template [.monitoring-logstash] [2018-05-29T15:33:40,752][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node-0] removing template [.monitoring-beats] ``` It turns out that this was my fault. I had configured the tests to delete the templates. This change configures the tests to keep the templates and any snapshots we make for good measure. This causes the `.monitoring-*` templates to be in the cluster state when we look for them. Closes #30925 --- distribution/src/config/log4j2.properties | 2 +- .../upgrades/AbstractRollingTestCase.java | 10 ++++++++++ .../UpgradeClusterClientYamlTestSuiteIT.java | 14 ++++++++++++-- .../java/org/elasticsearch/upgrades/XPackIT.java | 5 +++++ 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/distribution/src/config/log4j2.properties b/distribution/src/config/log4j2.properties index 1c4c04c7928d3..8533b2a6119b7 100644 --- a/distribution/src/config/log4j2.properties +++ b/distribution/src/config/log4j2.properties @@ -30,7 +30,7 @@ appender.rolling.strategy.action.condition.glob = ${sys:es.logs.cluster_name}-* appender.rolling.strategy.action.condition.nested_condition.type = IfAccumulatedFileSize appender.rolling.strategy.action.condition.nested_condition.exceeds = 2GB -rootLogger.level = info +rootLogger.level = debug rootLogger.appenderRef.console.ref = console rootLogger.appenderRef.rolling.ref = rolling diff --git a/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/AbstractRollingTestCase.java b/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/AbstractRollingTestCase.java index eb5517b7acb56..10ee480075bd9 100644 --- a/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/AbstractRollingTestCase.java +++ b/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/AbstractRollingTestCase.java @@ -53,6 +53,16 @@ protected final boolean preserveReposUponCompletion() { return true; } + @Override + protected boolean preserveTemplatesUponCompletion() { + return true; + } + + @Override + protected boolean preserveSnapshotsUponCompletion() { + return true; + } + @Override protected final Settings restClientSettings() { return Settings.builder().put(super.restClientSettings()) diff --git a/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/UpgradeClusterClientYamlTestSuiteIT.java b/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/UpgradeClusterClientYamlTestSuiteIT.java index 7932328c8c2f6..cd01bcd9e0e19 100644 --- a/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/UpgradeClusterClientYamlTestSuiteIT.java +++ b/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/UpgradeClusterClientYamlTestSuiteIT.java @@ -31,12 +31,22 @@ public class UpgradeClusterClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase { @Override - protected boolean preserveIndicesUponCompletion() { + protected final boolean preserveIndicesUponCompletion() { return true; } @Override - protected boolean preserveReposUponCompletion() { + protected final boolean preserveReposUponCompletion() { + return true; + } + + @Override + protected boolean preserveTemplatesUponCompletion() { + return true; + } + + @Override + protected boolean preserveSnapshotsUponCompletion() { return true; } diff --git a/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/XPackIT.java b/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/XPackIT.java index 136fa23475919..94f967f2e1bde 100644 --- a/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/XPackIT.java +++ b/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/XPackIT.java @@ -91,6 +91,11 @@ public void testIndexTemplatesCreated() throws Exception { expectedTemplates.add(".ml-meta"); expectedTemplates.add(".ml-notifications"); expectedTemplates.add(".ml-state"); + expectedTemplates.add(".monitoring-alerts"); + expectedTemplates.add(".monitoring-beats"); + expectedTemplates.add(".monitoring-es"); + expectedTemplates.add(".monitoring-kibana"); + expectedTemplates.add(".monitoring-logstash"); expectedTemplates.add("logstash-index-template"); expectedTemplates.add("security-index-template"); expectedTemplates.add("security_audit_log");