Testing: Ensure http.enabled is set consistently for all nodes in test

Make sure that IpFilteringUpdateTests set http.enabled for all nodes same.

Closes elastic/elasticsearch#748

Original commit: elastic/x-pack-elasticsearch@a26521afb1
This commit is contained in:
Alexander Reelsen 2015-03-03 09:10:57 +01:00
parent 7cfdf521c3
commit 9a3488304e

View File

@ -24,12 +24,10 @@ import static org.hamcrest.Matchers.is;
@ClusterScope(scope = TEST, numDataNodes = 1)
public class IpFilteringUpdateTests extends ShieldIntegrationTest {
private boolean httpEnabled = false;
private final boolean httpEnabled = randomBoolean();
@Override
protected Settings nodeSettings(int nodeOrdinal) {
httpEnabled = randomBoolean();
return settingsBuilder()
.put(super.nodeSettings(nodeOrdinal))
.put(InternalNode.HTTP_ENABLED, httpEnabled)
@ -104,7 +102,7 @@ public class IpFilteringUpdateTests extends ShieldIntegrationTest {
return;
}
IPFilter ipFilter = internalCluster().getInstance(IPFilter.class);
IPFilter ipFilter = internalCluster().getDataNodeInstance(IPFilter.class);
String message = String.format(Locale.ROOT, "Expected allowed connection for profile %s against host %s", profile, host);
assertThat(message, ipFilter.accept(profile, InetAddress.getByName(host)), is(true));
}
@ -115,7 +113,7 @@ public class IpFilteringUpdateTests extends ShieldIntegrationTest {
return;
}
IPFilter ipFilter = internalCluster().getInstance(IPFilter.class);
IPFilter ipFilter = internalCluster().getDataNodeInstance(IPFilter.class);
String message = String.format(Locale.ROOT, "Expected rejection for profile %s against host %s", profile, host);
assertThat(message, ipFilter.accept(profile, InetAddress.getByName(host)), is(false));
}