Cleanup usage of http.enabled (#19351)

Several tests required http.enabled where it was unnecessary.
We also had RestMainActionIT which tests what two of our REST tests
test already so I removed it.
The explicit use of http.enabled: false is also obsolet since our
test do that by default.
This commit is contained in:
Simon Willnauer 2016-07-11 10:21:03 +02:00 committed by GitHub
parent 306b1d9221
commit 36dbe7250f
6 changed files with 4 additions and 74 deletions

View File

@ -18,9 +18,7 @@
*/
package org.elasticsearch.bwcompat;
import org.elasticsearch.common.network.NetworkModule;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.node.Node;
import static org.hamcrest.Matchers.containsString;
@ -29,7 +27,7 @@ public class RecoveryWithUnsupportedIndicesIT extends StaticIndexBackwardCompati
String indexName = "unsupported-0.20.6";
logger.info("Checking static index {}", indexName);
Settings nodeSettings = prepareBackwardsDataDir(getBwcIndicesPath().resolve(indexName + ".zip"), NetworkModule.HTTP_ENABLED.getKey(), true);
Settings nodeSettings = prepareBackwardsDataDir(getBwcIndicesPath().resolve(indexName + ".zip"));
try {
internalCluster().startNode(nodeSettings);
fail();

View File

@ -51,16 +51,14 @@ public class TransportClientIT extends ESIntegTestCase {
public void testNodeVersionIsUpdated() throws IOException {
TransportClient client = (TransportClient) internalCluster().client();
Node node = new Node(Settings.builder()
try (Node node = new Node(Settings.builder()
.put(internalCluster().getDefaultSettings())
.put(Environment.PATH_HOME_SETTING.getKey(), createTempDir())
.put("node.name", "testNodeVersionIsUpdated")
.put("http.enabled", false)
.put(Node.NODE_DATA_SETTING.getKey(), false)
.put("cluster.name", "foobar")
.build());
node.start();
try {
.build()).start()) {
TransportAddress transportAddress = node.injector().getInstance(TransportService.class).boundAddress().publishAddress();
client.addTransportAddress(transportAddress);
// since we force transport clients there has to be one node started that we connect to.
@ -79,8 +77,6 @@ public class TransportClientIT extends ESIntegTestCase {
for (DiscoveryNode discoveryNode : client.filteredNodes()) {
assertThat(discoveryNode.getVersion(), equalTo(Version.CURRENT.minimumCompatibilityVersion()));
}
} finally {
node.close();
}
}

View File

@ -175,7 +175,6 @@ public class DiscoveryWithServiceDisruptionsIT extends ESIntegTestCase {
.put(FaultDetection.PING_RETRIES_SETTING.getKey(), "1") // for hitting simulated network failures quickly
.put("discovery.zen.join_timeout", "10s") // still long to induce failures but to long so test won't time out
.put(DiscoverySettings.PUBLISH_TIMEOUT_SETTING.getKey(), "1s") // <-- for hitting simulated network failures quickly
.put("http.enabled", false) // just to make test quicker
.build();
@Override

View File

@ -35,10 +35,7 @@ public class GatewayServiceTests extends ESTestCase {
ClusterService clusterService = new ClusterService(Settings.builder().put("cluster.name", "GatewayServiceTests").build(),
new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS),
null);
return new GatewayService(Settings.builder()
.put("http.enabled", "false")
.put("discovery.type", "local")
.put(settings.build()).build(),
return new GatewayService(settings.build(),
null, clusterService, null, null, null, new NoopDiscovery(), null, null);
}

View File

@ -58,10 +58,6 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSear
* Tests that requests with RefreshPolicy.WAIT_UNTIL will be visible when they return.
*/
public class WaitUntilRefreshIT extends ESIntegTestCase {
@Override
protected Settings nodeSettings(int nodeOrdinal) {
return Settings.builder().put(super.nodeSettings(nodeOrdinal)).put(NetworkModule.HTTP_ENABLED.getKey(), true).build();
}
@Override
public Settings indexSettings() {

View File

@ -1,56 +0,0 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.rest.action.main;
import org.apache.http.util.EntityUtils;
import org.elasticsearch.client.Response;
import org.elasticsearch.common.network.NetworkModule;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.test.ESIntegTestCase;
import java.io.IOException;
import java.util.Collections;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
public class RestMainActionIT extends ESIntegTestCase {
@Override
protected Settings nodeSettings(int nodeOrdinal) {
return Settings.builder()
.put(super.nodeSettings(nodeOrdinal))
.put(NetworkModule.HTTP_ENABLED.getKey(), true)
.build();
}
public void testHeadRequest() throws IOException {
try (Response response = getRestClient().performRequest("HEAD", "/", Collections.emptyMap(), null)) {
assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
assertNull(response.getEntity());
}
}
public void testGetRequest() throws IOException {
try (Response response = getRestClient().performRequest("GET", "/", Collections.emptyMap(), null)) {
assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
assertNotNull(response.getEntity());
assertThat(EntityUtils.toString(response.getEntity()), containsString("cluster_name"));
}
}
}