summaryrefslogtreecommitdiff
path: root/core/src/test/java/org/elasticsearch
diff options
context:
space:
mode:
authorJason Tedor <jason@tedor.me>2017-06-26 15:18:29 -0400
committerGitHub <noreply@github.com>2017-06-26 15:18:29 -0400
commit5a9fc8aa2ae81a6e251de0fa5bad389a1d4e4438 (patch)
tree2a69ed88ae75c2b5b655b7010528647936b040ed /core/src/test/java/org/elasticsearch
parent53b74348ff24eb19d49afad1061a2cbc234612a5 (diff)
Remove path.conf setting
This commit removes path.conf as a valid setting and replaces it with a command-line flag for specifying a non-default path for configuration. Relates #25392
Diffstat (limited to 'core/src/test/java/org/elasticsearch')
-rw-r--r--core/src/test/java/org/elasticsearch/action/update/UpdateRequestTests.java2
-rw-r--r--core/src/test/java/org/elasticsearch/common/settings/AddFileKeyStoreCommandTests.java2
-rw-r--r--core/src/test/java/org/elasticsearch/common/settings/AddStringKeyStoreCommandTests.java3
-rw-r--r--core/src/test/java/org/elasticsearch/common/settings/CreateKeyStoreCommandTests.java2
-rw-r--r--core/src/test/java/org/elasticsearch/common/settings/ListKeyStoreCommandTests.java3
-rw-r--r--core/src/test/java/org/elasticsearch/common/settings/RemoveSettingKeyStoreCommandTests.java12
-rw-r--r--core/src/test/java/org/elasticsearch/discovery/single/SingleNodeDiscoveryIT.java7
-rw-r--r--core/src/test/java/org/elasticsearch/env/EnvironmentTests.java30
-rw-r--r--core/src/test/java/org/elasticsearch/index/analysis/HunspellTokenFilterFactoryTests.java7
-rw-r--r--core/src/test/java/org/elasticsearch/indices/analyze/HunspellServiceTests.java25
-rw-r--r--core/src/test/java/org/elasticsearch/node/InternalSettingsPreparerTests.java2
-rw-r--r--core/src/test/java/org/elasticsearch/plugins/PluginsServiceTests.java2
-rw-r--r--core/src/test/java/org/elasticsearch/script/ScriptServiceTests.java2
-rw-r--r--core/src/test/java/org/elasticsearch/search/aggregations/metrics/ScriptedMetricIT.java22
-rw-r--r--core/src/test/java/org/elasticsearch/search/sort/AbstractSortTestCase.java2
-rw-r--r--core/src/test/java/org/elasticsearch/tribe/TribeServiceTests.java2
16 files changed, 61 insertions, 64 deletions
diff --git a/core/src/test/java/org/elasticsearch/action/update/UpdateRequestTests.java b/core/src/test/java/org/elasticsearch/action/update/UpdateRequestTests.java
index 8b389d69d3..4f50e70dde 100644
--- a/core/src/test/java/org/elasticsearch/action/update/UpdateRequestTests.java
+++ b/core/src/test/java/org/elasticsearch/action/update/UpdateRequestTests.java
@@ -75,10 +75,8 @@ public class UpdateRequestTests extends ESTestCase {
@Before
public void setUp() throws Exception {
super.setUp();
- final Path genericConfigFolder = createTempDir();
final Settings baseSettings = Settings.builder()
.put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString())
- .put(Environment.PATH_CONF_SETTING.getKey(), genericConfigFolder)
.build();
final Map<String, Function<Map<String, Object>, Object>> scripts = new HashMap<>();
scripts.put(
diff --git a/core/src/test/java/org/elasticsearch/common/settings/AddFileKeyStoreCommandTests.java b/core/src/test/java/org/elasticsearch/common/settings/AddFileKeyStoreCommandTests.java
index 9044103e43..9b592b7964 100644
--- a/core/src/test/java/org/elasticsearch/common/settings/AddFileKeyStoreCommandTests.java
+++ b/core/src/test/java/org/elasticsearch/common/settings/AddFileKeyStoreCommandTests.java
@@ -37,7 +37,7 @@ public class AddFileKeyStoreCommandTests extends KeyStoreCommandTestCase {
protected Command newCommand() {
return new AddFileKeyStoreCommand() {
@Override
- protected Environment createEnv(Terminal terminal, Map<String, String> settings) {
+ protected Environment createEnv(Terminal terminal, Map<String, String> settings, Path configPath) {
return env;
}
};
diff --git a/core/src/test/java/org/elasticsearch/common/settings/AddStringKeyStoreCommandTests.java b/core/src/test/java/org/elasticsearch/common/settings/AddStringKeyStoreCommandTests.java
index 11c3f107fe..20bf7421f7 100644
--- a/core/src/test/java/org/elasticsearch/common/settings/AddStringKeyStoreCommandTests.java
+++ b/core/src/test/java/org/elasticsearch/common/settings/AddStringKeyStoreCommandTests.java
@@ -22,6 +22,7 @@ package org.elasticsearch.common.settings;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
+import java.nio.file.Path;
import java.util.Map;
import org.elasticsearch.cli.Command;
@@ -39,7 +40,7 @@ public class AddStringKeyStoreCommandTests extends KeyStoreCommandTestCase {
protected Command newCommand() {
return new AddStringKeyStoreCommand() {
@Override
- protected Environment createEnv(Terminal terminal, Map<String, String> settings) {
+ protected Environment createEnv(Terminal terminal, Map<String, String> settings, Path configPath) {
return env;
}
@Override
diff --git a/core/src/test/java/org/elasticsearch/common/settings/CreateKeyStoreCommandTests.java b/core/src/test/java/org/elasticsearch/common/settings/CreateKeyStoreCommandTests.java
index 5d4741c729..da81f977e5 100644
--- a/core/src/test/java/org/elasticsearch/common/settings/CreateKeyStoreCommandTests.java
+++ b/core/src/test/java/org/elasticsearch/common/settings/CreateKeyStoreCommandTests.java
@@ -34,7 +34,7 @@ public class CreateKeyStoreCommandTests extends KeyStoreCommandTestCase {
protected Command newCommand() {
return new CreateKeyStoreCommand() {
@Override
- protected Environment createEnv(Terminal terminal, Map<String, String> settings) {
+ protected Environment createEnv(Terminal terminal, Map<String, String> settings, Path configPath) {
return env;
}
};
diff --git a/core/src/test/java/org/elasticsearch/common/settings/ListKeyStoreCommandTests.java b/core/src/test/java/org/elasticsearch/common/settings/ListKeyStoreCommandTests.java
index 1a8bdfc077..272ff5f419 100644
--- a/core/src/test/java/org/elasticsearch/common/settings/ListKeyStoreCommandTests.java
+++ b/core/src/test/java/org/elasticsearch/common/settings/ListKeyStoreCommandTests.java
@@ -19,6 +19,7 @@
package org.elasticsearch.common.settings;
+import java.nio.file.Path;
import java.util.Map;
import org.elasticsearch.cli.Command;
@@ -35,7 +36,7 @@ public class ListKeyStoreCommandTests extends KeyStoreCommandTestCase {
protected Command newCommand() {
return new ListKeyStoreCommand() {
@Override
- protected Environment createEnv(Terminal terminal, Map<String, String> settings) {
+ protected Environment createEnv(Terminal terminal, Map<String, String> settings, Path configPath) {
return env;
}
};
diff --git a/core/src/test/java/org/elasticsearch/common/settings/RemoveSettingKeyStoreCommandTests.java b/core/src/test/java/org/elasticsearch/common/settings/RemoveSettingKeyStoreCommandTests.java
index b74382d8cf..1ec25873a3 100644
--- a/core/src/test/java/org/elasticsearch/common/settings/RemoveSettingKeyStoreCommandTests.java
+++ b/core/src/test/java/org/elasticsearch/common/settings/RemoveSettingKeyStoreCommandTests.java
@@ -19,18 +19,16 @@
package org.elasticsearch.common.settings;
-import javax.crypto.SecretKeyFactory;
-import java.security.Provider;
-import java.security.Security;
-import java.util.Map;
-import java.util.Set;
-
import org.elasticsearch.cli.Command;
import org.elasticsearch.cli.ExitCodes;
import org.elasticsearch.cli.Terminal;
import org.elasticsearch.cli.UserException;
import org.elasticsearch.env.Environment;
+import java.nio.file.Path;
+import java.util.Map;
+import java.util.Set;
+
import static org.hamcrest.Matchers.containsString;
public class RemoveSettingKeyStoreCommandTests extends KeyStoreCommandTestCase {
@@ -39,7 +37,7 @@ public class RemoveSettingKeyStoreCommandTests extends KeyStoreCommandTestCase {
protected Command newCommand() {
return new RemoveSettingKeyStoreCommand() {
@Override
- protected Environment createEnv(Terminal terminal, Map<String, String> settings) {
+ protected Environment createEnv(Terminal terminal, Map<String, String> settings, Path configPath) {
return env;
}
};
diff --git a/core/src/test/java/org/elasticsearch/discovery/single/SingleNodeDiscoveryIT.java b/core/src/test/java/org/elasticsearch/discovery/single/SingleNodeDiscoveryIT.java
index d1b86aeaa1..07a76b108f 100644
--- a/core/src/test/java/org/elasticsearch/discovery/single/SingleNodeDiscoveryIT.java
+++ b/core/src/test/java/org/elasticsearch/discovery/single/SingleNodeDiscoveryIT.java
@@ -27,7 +27,6 @@ import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
-import org.elasticsearch.discovery.zen.PingContextProvider;
import org.elasticsearch.discovery.zen.UnicastHostsProvider;
import org.elasticsearch.discovery.zen.UnicastZenPing;
import org.elasticsearch.discovery.zen.ZenPing;
@@ -41,6 +40,7 @@ import org.elasticsearch.transport.TransportService;
import java.io.Closeable;
import java.io.IOException;
+import java.nio.file.Path;
import java.util.Collections;
import java.util.Stack;
import java.util.concurrent.CompletableFuture;
@@ -133,6 +133,11 @@ public class SingleNodeDiscoveryIT extends ESIntegTestCase {
.put("transport.tcp.port", port + "-" + (port + 5 - 1))
.build();
}
+
+ @Override
+ public Path nodeConfigPath(int nodeOrdinal) {
+ return null;
+ }
};
try (InternalTestCluster other =
new InternalTestCluster(
diff --git a/core/src/test/java/org/elasticsearch/env/EnvironmentTests.java b/core/src/test/java/org/elasticsearch/env/EnvironmentTests.java
index 083e2ad5cc..7b630b2544 100644
--- a/core/src/test/java/org/elasticsearch/env/EnvironmentTests.java
+++ b/core/src/test/java/org/elasticsearch/env/EnvironmentTests.java
@@ -144,29 +144,21 @@ public class EnvironmentTests extends ESTestCase {
assertThat(environment.logsFile(), equalTo(pathHome.resolve("logs")));
}
- public void testDefaultPathConf() {
- final Path defaultPathConf = createTempDir().toAbsolutePath();
- final Settings settings = Settings.builder()
- .put("path.home", createTempDir().toAbsolutePath())
- .put("default.path.conf", defaultPathConf)
- .build();
- final Environment environment = new Environment(settings);
- assertThat(environment.configFile(), equalTo(defaultPathConf));
+ public void testDefaultConfigPath() {
+ final Path path = createTempDir().toAbsolutePath();
+ final Settings settings = Settings.builder().put("path.home", path).build();
+ final Environment environment = new Environment(settings, null);
+ assertThat(environment.configFile(), equalTo(path.resolve("config")));
}
- public void testPathConfOverrideDefaultPathConf() {
- final Path pathConf = createTempDir().toAbsolutePath();
- final Path defaultPathConf = createTempDir().toAbsolutePath();
- final Settings settings = Settings.builder()
- .put("path.home", createTempDir().toAbsolutePath())
- .put("path.conf", pathConf)
- .put("default.path.conf", defaultPathConf)
- .build();
- final Environment environment = new Environment(settings);
- assertThat(environment.configFile(), equalTo(pathConf));
+ public void testConfigPath() {
+ final Path configPath = createTempDir().toAbsolutePath();
+ final Settings settings = Settings.builder().put("path.home", createTempDir().toAbsolutePath()).build();
+ final Environment environment = new Environment(settings, configPath);
+ assertThat(environment.configFile(), equalTo(configPath));
}
- public void testPathConfWhenNotSet() {
+ public void testConfigPathWhenNotSet() {
final Path pathHome = createTempDir().toAbsolutePath();
final Settings settings = Settings.builder().put("path.home", pathHome).build();
final Environment environment = new Environment(settings);
diff --git a/core/src/test/java/org/elasticsearch/index/analysis/HunspellTokenFilterFactoryTests.java b/core/src/test/java/org/elasticsearch/index/analysis/HunspellTokenFilterFactoryTests.java
index 2708387da1..49db663ed1 100644
--- a/core/src/test/java/org/elasticsearch/index/analysis/HunspellTokenFilterFactoryTests.java
+++ b/core/src/test/java/org/elasticsearch/index/analysis/HunspellTokenFilterFactoryTests.java
@@ -31,12 +31,12 @@ public class HunspellTokenFilterFactoryTests extends ESTestCase {
public void testDedup() throws IOException {
Settings settings = Settings.builder()
.put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString())
- .put(Environment.PATH_CONF_SETTING.getKey(), getDataPath("/indices/analyze/conf_dir"))
.put("index.analysis.filter.en_US.type", "hunspell")
.put("index.analysis.filter.en_US.locale", "en_US")
.build();
- TestAnalysis analysis = AnalysisTestsHelper.createTestAnalysisFromSettings(settings);
+ TestAnalysis analysis =
+ AnalysisTestsHelper.createTestAnalysisFromSettings(settings, getDataPath("/indices/analyze/conf_dir"));
TokenFilterFactory tokenFilter = analysis.tokenFilter.get("en_US");
assertThat(tokenFilter, instanceOf(HunspellTokenFilterFactory.class));
HunspellTokenFilterFactory hunspellTokenFilter = (HunspellTokenFilterFactory) tokenFilter;
@@ -44,13 +44,12 @@ public class HunspellTokenFilterFactoryTests extends ESTestCase {
settings = Settings.builder()
.put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString())
- .put(Environment.PATH_CONF_SETTING.getKey(), getDataPath("/indices/analyze/conf_dir"))
.put("index.analysis.filter.en_US.type", "hunspell")
.put("index.analysis.filter.en_US.dedup", false)
.put("index.analysis.filter.en_US.locale", "en_US")
.build();
- analysis = AnalysisTestsHelper.createTestAnalysisFromSettings(settings);
+ analysis = AnalysisTestsHelper.createTestAnalysisFromSettings(settings, getDataPath("/indices/analyze/conf_dir"));
tokenFilter = analysis.tokenFilter.get("en_US");
assertThat(tokenFilter, instanceOf(HunspellTokenFilterFactory.class));
hunspellTokenFilter = (HunspellTokenFilterFactory) tokenFilter;
diff --git a/core/src/test/java/org/elasticsearch/indices/analyze/HunspellServiceTests.java b/core/src/test/java/org/elasticsearch/indices/analyze/HunspellServiceTests.java
index ba4467a563..96e885b07a 100644
--- a/core/src/test/java/org/elasticsearch/indices/analyze/HunspellServiceTests.java
+++ b/core/src/test/java/org/elasticsearch/indices/analyze/HunspellServiceTests.java
@@ -24,6 +24,8 @@ import org.elasticsearch.env.Environment;
import org.elasticsearch.indices.analysis.HunspellService;
import org.elasticsearch.test.ESTestCase;
+import java.nio.file.Path;
+
import static java.util.Collections.emptyMap;
import static org.elasticsearch.indices.analysis.HunspellService.HUNSPELL_IGNORE_CASE;
import static org.elasticsearch.indices.analysis.HunspellService.HUNSPELL_LAZY_LOAD;
@@ -34,20 +36,19 @@ import static org.hamcrest.Matchers.notNullValue;
public class HunspellServiceTests extends ESTestCase {
public void testLocaleDirectoryWithNodeLevelConfig() throws Exception {
Settings settings = Settings.builder()
- .put(Environment.PATH_CONF_SETTING.getKey(), getDataPath("/indices/analyze/conf_dir"))
.put(HUNSPELL_LAZY_LOAD.getKey(), randomBoolean())
.put(HUNSPELL_IGNORE_CASE.getKey(), true)
.put(Environment.PATH_HOME_SETTING.getKey(), createTempDir())
.build();
- Dictionary dictionary = new HunspellService(settings, new Environment(settings), emptyMap()).getDictionary("en_US");
+ final Environment environment = new Environment(settings, getDataPath("/indices/analyze/conf_dir"));
+ Dictionary dictionary = new HunspellService(settings, environment, emptyMap()).getDictionary("en_US");
assertThat(dictionary, notNullValue());
assertTrue(dictionary.getIgnoreCase());
}
public void testLocaleDirectoryWithLocaleSpecificConfig() throws Exception {
Settings settings = Settings.builder()
- .put(Environment.PATH_CONF_SETTING.getKey(), getDataPath("/indices/analyze/conf_dir"))
.put(HUNSPELL_LAZY_LOAD.getKey(), randomBoolean())
.put(HUNSPELL_IGNORE_CASE.getKey(), true)
.put("indices.analysis.hunspell.dictionary.en_US.strict_affix_parsing", false)
@@ -55,38 +56,44 @@ public class HunspellServiceTests extends ESTestCase {
.put(Environment.PATH_HOME_SETTING.getKey(), createTempDir())
.build();
- Dictionary dictionary = new HunspellService(settings, new Environment(settings), emptyMap()).getDictionary("en_US");
+ final Path configPath = getDataPath("/indices/analyze/conf_dir");
+ final Environment environment = new Environment(settings, configPath);
+ Dictionary dictionary = new HunspellService(settings, environment, emptyMap()).getDictionary("en_US");
assertThat(dictionary, notNullValue());
assertFalse(dictionary.getIgnoreCase());
// testing that dictionary specific settings override node level settings
- dictionary = new HunspellService(settings, new Environment(settings), emptyMap()).getDictionary("en_US_custom");
+ dictionary = new HunspellService(settings, new Environment(settings, configPath), emptyMap()).getDictionary("en_US_custom");
assertThat(dictionary, notNullValue());
assertTrue(dictionary.getIgnoreCase());
}
public void testDicWithNoAff() throws Exception {
Settings settings = Settings.builder()
- .put(Environment.PATH_CONF_SETTING.getKey(), getDataPath("/indices/analyze/no_aff_conf_dir"))
.put(HUNSPELL_LAZY_LOAD.getKey(), randomBoolean())
.put(Environment.PATH_HOME_SETTING.getKey(), createTempDir())
.build();
IllegalStateException e = expectThrows(IllegalStateException.class,
- () -> new HunspellService(settings, new Environment(settings), emptyMap()).getDictionary("en_US"));
+ () -> {
+ final Environment environment = new Environment(settings, getDataPath("/indices/analyze/no_aff_conf_dir"));
+ new HunspellService(settings, environment, emptyMap()).getDictionary("en_US");
+ });
assertEquals("failed to load hunspell dictionary for locale: en_US", e.getMessage());
assertThat(e.getCause(), hasToString(containsString("Missing affix file")));
}
public void testDicWithTwoAffs() throws Exception {
Settings settings = Settings.builder()
- .put(Environment.PATH_CONF_SETTING.getKey(), getDataPath("/indices/analyze/two_aff_conf_dir"))
.put(HUNSPELL_LAZY_LOAD.getKey(), randomBoolean())
.put(Environment.PATH_HOME_SETTING.getKey(), createTempDir())
.build();
IllegalStateException e = expectThrows(IllegalStateException.class,
- () -> new HunspellService(settings, new Environment(settings), emptyMap()).getDictionary("en_US"));
+ () -> {
+ final Environment environment = new Environment(settings, getDataPath("/indices/analyze/two_aff_conf_dir"));
+ new HunspellService(settings, environment, emptyMap()).getDictionary("en_US");
+ });
assertEquals("failed to load hunspell dictionary for locale: en_US", e.getMessage());
assertThat(e.getCause(), hasToString(containsString("Too many affix files")));
}
diff --git a/core/src/test/java/org/elasticsearch/node/InternalSettingsPreparerTests.java b/core/src/test/java/org/elasticsearch/node/InternalSettingsPreparerTests.java
index bf23da1868..1ce6ed5779 100644
--- a/core/src/test/java/org/elasticsearch/node/InternalSettingsPreparerTests.java
+++ b/core/src/test/java/org/elasticsearch/node/InternalSettingsPreparerTests.java
@@ -181,7 +181,7 @@ public class InternalSettingsPreparerTests extends ESTestCase {
public void testDefaultPropertiesDoNothing() throws Exception {
Map<String, String> props = Collections.singletonMap("default.setting", "foo");
- Environment env = InternalSettingsPreparer.prepareEnvironment(baseEnvSettings, null, props);
+ Environment env = InternalSettingsPreparer.prepareEnvironment(baseEnvSettings, null, props, null);
assertEquals("foo", env.settings().get("default.setting"));
assertNull(env.settings().get("setting"));
}
diff --git a/core/src/test/java/org/elasticsearch/plugins/PluginsServiceTests.java b/core/src/test/java/org/elasticsearch/plugins/PluginsServiceTests.java
index e980081479..7f91d11acd 100644
--- a/core/src/test/java/org/elasticsearch/plugins/PluginsServiceTests.java
+++ b/core/src/test/java/org/elasticsearch/plugins/PluginsServiceTests.java
@@ -54,7 +54,7 @@ public class PluginsServiceTests extends ESTestCase {
public static class FilterablePlugin extends Plugin implements ScriptPlugin {}
static PluginsService newPluginsService(Settings settings, Class<? extends Plugin>... classpathPlugins) {
- return new PluginsService(settings, null, new Environment(settings).pluginsFile(), Arrays.asList(classpathPlugins));
+ return new PluginsService(settings, null, null, new Environment(settings).pluginsFile(), Arrays.asList(classpathPlugins));
}
public void testAdditionalSettings() {
diff --git a/core/src/test/java/org/elasticsearch/script/ScriptServiceTests.java b/core/src/test/java/org/elasticsearch/script/ScriptServiceTests.java
index 9a81b1bcbb..c943f98a66 100644
--- a/core/src/test/java/org/elasticsearch/script/ScriptServiceTests.java
+++ b/core/src/test/java/org/elasticsearch/script/ScriptServiceTests.java
@@ -54,10 +54,8 @@ public class ScriptServiceTests extends ESTestCase {
@Before
public void setup() throws IOException {
- Path genericConfigFolder = createTempDir();
baseSettings = Settings.builder()
.put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString())
- .put(Environment.PATH_CONF_SETTING.getKey(), genericConfigFolder)
.put(ScriptService.SCRIPT_MAX_COMPILATIONS_PER_MINUTE.getKey(), 10000)
.build();
Map<String, Function<Map<String, Object>, Object>> scripts = new HashMap<>();
diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/metrics/ScriptedMetricIT.java b/core/src/test/java/org/elasticsearch/search/aggregations/metrics/ScriptedMetricIT.java
index a2ebb378fc..4fc4ec9ac6 100644
--- a/core/src/test/java/org/elasticsearch/search/aggregations/metrics/ScriptedMetricIT.java
+++ b/core/src/test/java/org/elasticsearch/search/aggregations/metrics/ScriptedMetricIT.java
@@ -25,7 +25,6 @@ import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.common.xcontent.support.XContentMapValues;
-import org.elasticsearch.env.Environment;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.script.MockScriptPlugin;
import org.elasticsearch.script.Script;
@@ -40,6 +39,7 @@ import org.elasticsearch.search.aggregations.metrics.scripted.ScriptedMetric;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
import org.elasticsearch.test.ESIntegTestCase.Scope;
+import org.junit.Before;
import java.io.IOException;
import java.nio.file.Files;
@@ -253,14 +253,16 @@ public class ScriptedMetricIT extends ESIntegTestCase {
ensureSearchable();
}
- @Override
- protected Settings nodeSettings(int nodeOrdinal) {
- Path config = createTempDir().resolve("config");
- Path scripts = config.resolve("scripts");
+ private Path config;
+
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ config = createTempDir().resolve("config");
+ final Path scripts = config.resolve("scripts");
try {
Files.createDirectories(scripts);
-
// When using the MockScriptPlugin we can map File scripts to inline scripts:
// the name of the file script is used in test method while the source of the file script
// must match a predefined script from CustomScriptPlugin.pluginScripts() method
@@ -271,11 +273,11 @@ public class ScriptedMetricIT extends ESIntegTestCase {
} catch (IOException e) {
throw new RuntimeException("failed to create scripts");
}
+ }
- return Settings.builder()
- .put(super.nodeSettings(nodeOrdinal))
- .put(Environment.PATH_CONF_SETTING.getKey(), config)
- .build();
+ @Override
+ protected Path nodeConfigPath(int nodeOrdinal) {
+ return config;
}
public void testMap() {
diff --git a/core/src/test/java/org/elasticsearch/search/sort/AbstractSortTestCase.java b/core/src/test/java/org/elasticsearch/search/sort/AbstractSortTestCase.java
index a9d81c72f4..8e6b9f45cc 100644
--- a/core/src/test/java/org/elasticsearch/search/sort/AbstractSortTestCase.java
+++ b/core/src/test/java/org/elasticsearch/search/sort/AbstractSortTestCase.java
@@ -81,10 +81,8 @@ public abstract class AbstractSortTestCase<T extends SortBuilder<T>> extends EST
@BeforeClass
public static void init() throws IOException {
- Path genericConfigFolder = createTempDir();
Settings baseSettings = Settings.builder()
.put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString())
- .put(Environment.PATH_CONF_SETTING.getKey(), genericConfigFolder)
.build();
Map<String, Function<Map<String, Object>, Object>> scripts = Collections.singletonMap("dummy", p -> null);
ScriptEngine engine = new MockScriptEngine(MockScriptEngine.NAME, scripts);
diff --git a/core/src/test/java/org/elasticsearch/tribe/TribeServiceTests.java b/core/src/test/java/org/elasticsearch/tribe/TribeServiceTests.java
index 070d367337..ac9e3156e1 100644
--- a/core/src/test/java/org/elasticsearch/tribe/TribeServiceTests.java
+++ b/core/src/test/java/org/elasticsearch/tribe/TribeServiceTests.java
@@ -68,11 +68,9 @@ public class TribeServiceTests extends ESTestCase {
Settings globalSettings = Settings.builder()
.put("node.name", "nodename")
.put("path.home", "some/path")
- .put("path.conf", "conf/path")
.put("path.logs", "logs/path").build();
Settings clientSettings = TribeService.buildClientSettings("tribe1", "parent_id", globalSettings, Settings.EMPTY);
assertEquals("some/path", clientSettings.get("path.home"));
- assertEquals("conf/path", clientSettings.get("path.conf"));
assertEquals("logs/path", clientSettings.get("path.logs"));
Settings tribeSettings = Settings.builder()