From 7f6c3814b708b3ebf7c42af414167d6179419187 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Sat, 25 Apr 2015 17:42:48 +0200 Subject: [PATCH] test: unset 'shieldEnabled' and 'scheduleEngine' after test class is completed. Original commit: elastic/x-pack-elasticsearch@3e9332df946d0785e1118642ef656cd3a4f4cef9 --- .../test/AbstractWatcherIntegrationTests.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/test/java/org/elasticsearch/watcher/test/AbstractWatcherIntegrationTests.java b/src/test/java/org/elasticsearch/watcher/test/AbstractWatcherIntegrationTests.java index f0ba1166f63..e13fe98eb2d 100644 --- a/src/test/java/org/elasticsearch/watcher/test/AbstractWatcherIntegrationTests.java +++ b/src/test/java/org/elasticsearch/watcher/test/AbstractWatcherIntegrationTests.java @@ -60,6 +60,7 @@ import org.elasticsearch.watcher.trigger.schedule.Schedules; import org.elasticsearch.watcher.watch.Watch; import org.elasticsearch.watcher.WatcherService; import org.junit.After; +import org.junit.AfterClass; import org.junit.Before; import java.io.File; @@ -91,13 +92,6 @@ public abstract class AbstractWatcherIntegrationTests extends ElasticsearchInteg @Override protected Settings nodeSettings(int nodeOrdinal) { - if (scheduleEngine == null) { - scheduleEngine = randomFrom(ScheduleModule.Engine.values()); - } - if (shieldEnabled == null) { - shieldEnabled = enableShield(); - } - String scheduleImplName = scheduleEngine().name().toLowerCase(Locale.ROOT); logger.info("using schedule engine [" + scheduleImplName + "]"); return ImmutableSettings.builder() @@ -160,6 +154,12 @@ public abstract class AbstractWatcherIntegrationTests extends ElasticsearchInteg stopWatcher(); } + @AfterClass + public static void _cleanupClass() { + shieldEnabled = null; + scheduleEngine = null; + } + @Override protected Settings transportClientSettings() { if (!shieldEnabled) { @@ -503,6 +503,12 @@ public abstract class AbstractWatcherIntegrationTests extends ElasticsearchInteg @Override public void beforeTest(Random random, double transportClientRatio) throws IOException { + if (scheduleEngine == null) { + scheduleEngine = randomFrom(ScheduleModule.Engine.values()); + } + if (shieldEnabled == null) { + shieldEnabled = enableShield(); + } testCluster.beforeTest(random, transportClientRatio); }