From 7d481aab94d8df70c7f3757a6eb4da69885c5385 Mon Sep 17 00:00:00 2001 From: Chris Earle Date: Fri, 25 Mar 2016 18:45:24 -0400 Subject: [PATCH] Making Watcher disabled by default for Monitoring Integration tests Some tests [reasonably] fail due to unexpected indices appearing in the cluster due to Watcher. - Also had to reset shieldEnabled as a static field, which makes no sense, but tests were failing unpredictably without it - Now they're passing unpredictably with it... will investigate Original commit: elastic/x-pack-elasticsearch@9b6ce681d86f98a6857cc54d16e5b3422b4aaff0 --- .../marvel/agent/resolver/node/NodeStatsTests.java | 7 +++++++ .../marvel/test/MarvelIntegTestCase.java | 13 +++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/node/NodeStatsTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/node/NodeStatsTests.java index 3ec5fb69026..a54223eba0f 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/node/NodeStatsTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/node/NodeStatsTests.java @@ -96,4 +96,11 @@ public class NodeStatsTests extends MarvelIntegTestCase { return Arrays.stream(NodeStatsResolver.FILTERS).filter(s -> s.contains("watcher") == false).toArray(String[]::new); } + + @Override + protected boolean enableWatcher() { + // currently this is the only Monitoring test that expects Watcher to be enabled. + // Once this becomes the default, then this should be removed. + return randomBoolean(); + } } diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/test/MarvelIntegTestCase.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/test/MarvelIntegTestCase.java index f4cc408a1b1..a2c9daae982 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/test/MarvelIntegTestCase.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/test/MarvelIntegTestCase.java @@ -73,11 +73,12 @@ public abstract class MarvelIntegTestCase extends ESIntegTestCase { *

* Control this by overriding {@link #enableShield()}, which defaults to enabling it randomly. */ - protected Boolean shieldEnabled; + // SCARY: This needs to be static or lots of tests randomly fail, but it's not used statically! + protected static Boolean shieldEnabled; /** * Enables individual tests to control the behavior. *

- * Control this by overriding {@link #enableWatcher()}, which defaults to enabling it randomly. + * Control this by overriding {@link #enableWatcher()}, which defaults to disabling it (this will change!). */ protected Boolean watcherEnabled; @@ -89,8 +90,10 @@ public abstract class MarvelIntegTestCase extends ESIntegTestCase { if (watcherEnabled == null) { watcherEnabled = enableWatcher(); } - logger.info("--> shield {}", shieldEnabled ? "enabled" : "disabled"); + + logger.debug("--> shield {}", shieldEnabled ? "enabled" : "disabled"); logger.debug("--> watcher {}", watcherEnabled ? "enabled" : "disabled"); + return super.buildTestCluster(scope, seed); } @@ -174,7 +177,9 @@ public abstract class MarvelIntegTestCase extends ESIntegTestCase { * Override and return {@code false} to force running without Watcher. */ protected boolean enableWatcher() { - return randomBoolean(); + // Once randomDefault() becomes the default again, then this should only be actively disabled when + // trying to figure out exactly how many indices are at play + return false; } protected void stopCollection() {