From ae960f976d21863f15626358d4a06163eb29653e Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Fri, 4 Nov 2016 11:11:05 -0400 Subject: [PATCH] Slow down montiring bwc tests some more Make them do things slightly less frequently and wait longer to make sure everything is shut down. Sometimes it takes a while but it does get there. Original commit: elastic/x-pack-elasticsearch@76fc4acf4709c474520c93acade5c2d281e497cf --- ...OldMonitoringIndicesBackwardsCompatibilityIT.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/monitoring/OldMonitoringIndicesBackwardsCompatibilityIT.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/monitoring/OldMonitoringIndicesBackwardsCompatibilityIT.java index a5851e33c42..b7c2d013dba 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/monitoring/OldMonitoringIndicesBackwardsCompatibilityIT.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/monitoring/OldMonitoringIndicesBackwardsCompatibilityIT.java @@ -5,6 +5,8 @@ */ package org.elasticsearch.xpack.monitoring; +import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering; + import org.elasticsearch.AbstractOldXPackIndicesBackwardsCompatibilityTestCase; import org.elasticsearch.Version; import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse; @@ -33,7 +35,6 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; -import static org.elasticsearch.common.unit.TimeValue.timeValueMillis; import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; @@ -45,6 +46,8 @@ import static org.hamcrest.Matchers.hasKey; /** * Tests for monitoring indexes created before {@link Version#CURRENT}. */ +//Give ourselves 30 seconds instead o 5 to shut down. Sometimes it takes a while, especially on weak hardware. But we do get there. +@ThreadLeakLingering(linger = 30000) public class OldMonitoringIndicesBackwardsCompatibilityIT extends AbstractOldXPackIndicesBackwardsCompatibilityTestCase { private final boolean httpExporter = randomBoolean(); @@ -55,7 +58,7 @@ public class OldMonitoringIndicesBackwardsCompatibilityIT extends AbstractOldXPa // Don't clean old monitoring indexes - we want to make sure we can load them .put(MonitoringSettings.HISTORY_DURATION.getKey(), TimeValue.timeValueHours(1000 * 365 * 24).getStringRep()) // Speed up the exporter so we don't have to wait around for it - .put(MonitoringSettings.INTERVAL.getKey(), timeValueMillis(500).getStringRep()); + .put(MonitoringSettings.INTERVAL.getKey(), timeValueSeconds(1).getStringRep()); if (httpExporter) { /* If we want to test the http exporter we have to create it but disable it. We need to create it so we don't use the default @@ -91,6 +94,11 @@ public class OldMonitoringIndicesBackwardsCompatibilityIT extends AbstractOldXPa private void checkVersionInternal(Version version) throws Exception { if (version.before(Version.V_2_3_0)) { + // Slow down monitoring from its previously super fast pace so we can shut down without trouble + Settings.Builder settings = Settings.builder() + .put(MonitoringSettings.INTERVAL.getKey(), timeValueSeconds(10).getStringRep()); + assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(settings).get()); + /* We can't do anything with indexes created before 2.3 so we just assert that we didn't delete them or do anything otherwise * crazy. */ SearchResponse response = client().prepareSearch(".marvel-es-data").get();