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@9b6ce681d8
This commit is contained in:
Chris Earle 2016-03-25 18:45:24 -04:00
parent 5d3a608786
commit 7d481aab94
2 changed files with 16 additions and 4 deletions

View File

@ -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();
}
}

View File

@ -73,11 +73,12 @@ public abstract class MarvelIntegTestCase extends ESIntegTestCase {
* <p>
* 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.
* <p>
* 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() {