fixed tests when shield is disabled

- also turned shield testing to be random

Original commit: elastic/x-pack-elasticsearch@9f236826ea
This commit is contained in:
uboness 2015-09-25 22:33:55 +02:00
parent 00f8e40a99
commit dd2f0dbce5
1 changed files with 8 additions and 5 deletions

View File

@ -62,9 +62,8 @@ public abstract class MarvelIntegTestCase extends ESIntegTestCase {
// we do this by default in core, but for marvel this isn't needed and only adds noise. // we do this by default in core, but for marvel this isn't needed and only adds noise.
.put("index.store.mock.check_index_on_close", false); .put("index.store.mock.check_index_on_close", false);
if (shieldEnabled) { ShieldSettings.apply(shieldEnabled, builder);
ShieldSettings.apply(builder);
}
return builder.build(); return builder.build();
} }
@ -97,7 +96,7 @@ public abstract class MarvelIntegTestCase extends ESIntegTestCase {
* Override and returns {@code false} to force running without shield * Override and returns {@code false} to force running without shield
*/ */
protected boolean enableShield() { protected boolean enableShield() {
return true; //randomBoolean(); return randomBoolean();
} }
protected void stopCollection() { protected void stopCollection() {
@ -292,7 +291,11 @@ public abstract class MarvelIntegTestCase extends ESIntegTestCase {
; ;
public static void apply(Settings.Builder builder) { public static void apply(boolean enabled, Settings.Builder builder) {
if (!enabled) {
builder.put("shield.enabled", false);
return;
}
try { try {
Path folder = createTempDir().resolve("marvel_shield"); Path folder = createTempDir().resolve("marvel_shield");
Files.createDirectories(folder); Files.createDirectories(folder);