Skip to content

Commit

Permalink
Networking: Deprecate http.enabled setting (#29591)
Browse files Browse the repository at this point in the history
This commit deprecates the http.enabled, in preparation for removing the
feature in 7.0.

relates #12792
  • Loading branch information
rjernst authored Apr 19, 2018
1 parent 0c9baeb commit 98d776e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public final class NetworkModule {
Property.NodeScope);
public static final Setting<String> HTTP_DEFAULT_TYPE_SETTING = Setting.simpleString(HTTP_TYPE_DEFAULT_KEY, Property.NodeScope);
public static final Setting<String> HTTP_TYPE_SETTING = Setting.simpleString(HTTP_TYPE_KEY, Property.NodeScope);
public static final Setting<Boolean> HTTP_ENABLED = Setting.boolSetting("http.enabled", true, Property.NodeScope);
public static final Setting<Boolean> HTTP_ENABLED = Setting.boolSetting("http.enabled", true,
Property.NodeScope, Property.Deprecated);
public static final Setting<String> TRANSPORT_TYPE_SETTING = Setting.simpleString(TRANSPORT_TYPE_KEY, Property.NodeScope);

private final Settings settings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.elasticsearch.common.component.AbstractLifecycleComponent;
import org.elasticsearch.common.inject.ModuleTestCase;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.BoundTransportAddress;
import org.elasticsearch.common.util.BigArrays;
Expand Down Expand Up @@ -151,6 +152,7 @@ public Map<String, Supplier<Transport>> getTransports(Settings settings, ThreadP
assertSame(custom, module.getTransportSupplier());
assertTrue(module.isTransportClient());
assertFalse(module.isHttpEnabled());
assertSettingDeprecationsAndWarnings(new Setting<?>[] { NetworkModule.HTTP_ENABLED });
}

public void testRegisterHttpTransport() {
Expand Down Expand Up @@ -181,6 +183,7 @@ public Map<String, Supplier<HttpServerTransport>> getHttpTransports(Settings set
assertFalse(newModule.isTransportClient());
assertFalse(newModule.isHttpEnabled());
expectThrows(IllegalStateException.class, () -> newModule.getHttpServerTransportSupplier());
assertSettingDeprecationsAndWarnings(new Setting<?>[] { NetworkModule.HTTP_ENABLED });
}

public void testOverrideDefault() {
Expand Down Expand Up @@ -306,7 +309,7 @@ public List<TransportInterceptor> getTransportInterceptors(NamedWriteableRegistr
});
});
assertEquals("interceptor must not be null", nullPointerException.getMessage());

assertSettingDeprecationsAndWarnings(new Setting<?>[] { NetworkModule.HTTP_ENABLED });
}

private NetworkModule newNetworkModule(Settings settings, boolean transportClient, NetworkPlugin... plugins) {
Expand Down
4 changes: 4 additions & 0 deletions server/src/test/java/org/elasticsearch/node/NodeTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.elasticsearch.bootstrap.BootstrapContext;
import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.common.network.NetworkModule;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.BoundTransportAddress;
import org.elasticsearch.env.Environment;
Expand Down Expand Up @@ -62,6 +63,7 @@ public void testNodeName() throws IOException {
assertThat(Node.NODE_NAME_SETTING.get(nodeSettings), equalTo(name));
}
}
assertSettingDeprecationsAndWarnings(new Setting<?>[] { NetworkModule.HTTP_ENABLED });
}

public static class CheckPlugin extends Plugin {
Expand Down Expand Up @@ -93,6 +95,7 @@ protected void validateNodeBeforeAcceptingRequests(BootstrapContext context, Bou
expectThrows(NodeValidationException.class, () -> node.start());
assertTrue(executed.get());
}
assertSettingDeprecationsAndWarnings(new Setting<?>[] { NetworkModule.HTTP_ENABLED });
}

public void testWarnIfPreRelease() {
Expand Down Expand Up @@ -144,6 +147,7 @@ public void testNodeAttributes() throws IOException {
} catch (IllegalArgumentException e) {
assertEquals("node.attr.test_attr cannot have leading or trailing whitespace [trailing ]", e.getMessage());
}
assertSettingDeprecationsAndWarnings(new Setting<?>[] { NetworkModule.HTTP_ENABLED });
}

private static Settings.Builder baseSettings() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

package org.elasticsearch.node;

import org.elasticsearch.common.network.NetworkModule;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.BigArrays;
import org.elasticsearch.common.util.MockBigArrays;
Expand Down Expand Up @@ -67,5 +69,6 @@ public void testComponentsMockedByMarkerPlugins() throws IOException {
assertSame(searchService.getClass(), SearchService.class);
}
}
assertSettingDeprecationsAndWarnings(new Setting<?>[] { NetworkModule.HTTP_ENABLED });
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
package org.elasticsearch.test.test;

import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.core.internal.io.IOUtils;
import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.client.Client;
Expand Down Expand Up @@ -242,6 +243,7 @@ public Settings transportClientSettings() {
} finally {
IOUtils.close(cluster0, cluster1);
}
assertSettingDeprecationsAndWarnings(new Setting<?>[] { NetworkModule.HTTP_ENABLED });
}

public void testDataFolderAssignmentAndCleaning() throws IOException, InterruptedException {
Expand Down Expand Up @@ -346,6 +348,7 @@ public Settings transportClientSettings() {
} finally {
cluster.close();
}
assertSettingDeprecationsAndWarnings(new Setting<?>[] { NetworkModule.HTTP_ENABLED });
}

private Path[] getNodePaths(InternalTestCluster cluster, String name) {
Expand Down Expand Up @@ -446,6 +449,7 @@ public Settings transportClientSettings() {
} finally {
cluster.close();
}
assertSettingDeprecationsAndWarnings(new Setting<?>[] { NetworkModule.HTTP_ENABLED });
}

public void testTwoNodeCluster() throws Exception {
Expand Down Expand Up @@ -505,5 +509,6 @@ public Settings onNodeStopped(String nodeName) throws Exception {
} finally {
cluster.close();
}
assertSettingDeprecationsAndWarnings(new Setting<?>[] { NetworkModule.HTTP_ENABLED });
}
}

0 comments on commit 98d776e

Please sign in to comment.