Tests: Refactor NodeTests settings (#25309)

This pull request aims to use the method baseSettings already present in the class.
This commit is contained in:
Guillaume Le Floch 2017-06-20 15:17:52 +02:00 committed by Christoph Büscher
parent 62d1969595
commit 93e29d290f
1 changed files with 3 additions and 15 deletions

View File

@ -57,14 +57,8 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
public class NodeTests extends ESTestCase { public class NodeTests extends ESTestCase {
public void testNodeName() throws IOException { public void testNodeName() throws IOException {
final Path tempDir = createTempDir();
final String name = randomBoolean() ? randomAlphaOfLength(10) : null; final String name = randomBoolean() ? randomAlphaOfLength(10) : null;
Settings.Builder settings = Settings.builder() Settings.Builder settings = baseSettings();
.put(ClusterName.CLUSTER_NAME_SETTING.getKey(), InternalTestCluster.clusterName("single-node-cluster", randomLong()))
.put(Environment.PATH_HOME_SETTING.getKey(), tempDir)
.put(NetworkModule.HTTP_ENABLED.getKey(), false)
.put("transport.type", "mock-socket-network")
.put(Node.NODE_DATA_SETTING.getKey(), true);
if (name != null) { if (name != null) {
settings.put(Node.NODE_NAME_SETTING.getKey(), name); settings.put(Node.NODE_NAME_SETTING.getKey(), name);
} }
@ -97,14 +91,8 @@ public class NodeTests extends ESTestCase {
} }
public void testLoadPluginBootstrapChecks() throws IOException { public void testLoadPluginBootstrapChecks() throws IOException {
final Path tempDir = createTempDir();
final String name = randomBoolean() ? randomAlphaOfLength(10) : null; final String name = randomBoolean() ? randomAlphaOfLength(10) : null;
Settings.Builder settings = Settings.builder() Settings.Builder settings = baseSettings();
.put(ClusterName.CLUSTER_NAME_SETTING.getKey(), InternalTestCluster.clusterName("single-node-cluster", randomLong()))
.put(Environment.PATH_HOME_SETTING.getKey(), tempDir)
.put(NetworkModule.HTTP_ENABLED.getKey(), false)
.put("transport.type", "mock-socket-network")
.put(Node.NODE_DATA_SETTING.getKey(), true);
if (name != null) { if (name != null) {
settings.put(Node.NODE_NAME_SETTING.getKey(), name); settings.put(Node.NODE_NAME_SETTING.getKey(), name);
} }
@ -247,7 +235,7 @@ public class NodeTests extends ESTestCase {
.put(ClusterName.CLUSTER_NAME_SETTING.getKey(), InternalTestCluster.clusterName("single-node-cluster", randomLong())) .put(ClusterName.CLUSTER_NAME_SETTING.getKey(), InternalTestCluster.clusterName("single-node-cluster", randomLong()))
.put(Environment.PATH_HOME_SETTING.getKey(), tempDir) .put(Environment.PATH_HOME_SETTING.getKey(), tempDir)
.put(NetworkModule.HTTP_ENABLED.getKey(), false) .put(NetworkModule.HTTP_ENABLED.getKey(), false)
.put("transport.type", "mock-socket-network") .put(NetworkModule.TRANSPORT_TYPE_KEY, "mock-socket-network")
.put(Node.NODE_DATA_SETTING.getKey(), true); .put(Node.NODE_DATA_SETTING.getKey(), true);
} }