test: ensure that 'shieldEnabled' field is only set once.
The HttpInputIntegrationTest sometimes unsetted the 'shieldEnabled' field for subsequent test methods, this caused http 401 errors, because the nodes were started with Shield enabled. Original commit: elastic/x-pack-elasticsearch@b39ca9647d
This commit is contained in:
parent
4530232060
commit
5d494a7b2d
|
@ -20,8 +20,6 @@ import org.elasticsearch.watcher.watch.Watch;
|
|||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import static org.elasticsearch.watcher.actions.ActionBuilders.loggingAction;
|
||||
import static org.elasticsearch.watcher.client.WatchSourceBuilders.watchBuilder;
|
||||
import static org.elasticsearch.watcher.condition.ConditionBuilders.alwaysCondition;
|
||||
|
@ -31,7 +29,6 @@ import static org.elasticsearch.watcher.trigger.TriggerBuilders.schedule;
|
|||
import static org.elasticsearch.watcher.trigger.schedule.Schedules.cron;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
@ClusterScope(scope = Scope.SUITE, randomDynamicTemplates = false)
|
||||
public class ManualExecutionTests extends AbstractWatcherIntegrationTests {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -85,12 +85,19 @@ public abstract class AbstractWatcherIntegrationTests extends ElasticsearchInteg
|
|||
|
||||
private TimeWarp timeWarp;
|
||||
|
||||
boolean shieldEnabled = enableShield();
|
||||
private static Boolean shieldEnabled;
|
||||
|
||||
final ScheduleModule.Engine scheduleEngine = randomFrom(ScheduleModule.Engine.values());
|
||||
private static ScheduleModule.Engine scheduleEngine;
|
||||
|
||||
@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()
|
||||
|
@ -118,14 +125,14 @@ public abstract class AbstractWatcherIntegrationTests extends ElasticsearchInteg
|
|||
/**
|
||||
* @return whether shield has been enabled
|
||||
*/
|
||||
protected boolean shieldEnabled() {
|
||||
protected final boolean shieldEnabled() {
|
||||
return shieldEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The schedule trigger engine that will be used for the nodes.
|
||||
*/
|
||||
protected ScheduleModule.Engine scheduleEngine() {
|
||||
protected final ScheduleModule.Engine scheduleEngine() {
|
||||
return scheduleEngine;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,8 +36,6 @@ import static org.elasticsearch.watcher.trigger.TriggerBuilders.schedule;
|
|||
import static org.elasticsearch.watcher.trigger.schedule.Schedules.interval;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class HttpInputIntegrationTest extends AbstractWatcherIntegrationTests {
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue