summaryrefslogtreecommitdiff
path: root/core/src/test/java/org/elasticsearch
diff options
context:
space:
mode:
authorJason Tedor <jason@tedor.me>2017-06-26 21:43:20 -0400
committerGitHub <noreply@github.com>2017-06-26 21:43:20 -0400
commitdfd241e0a66192ca4e7599ca49c26d2d165af7b8 (patch)
tree43e3c23c3e41b9e7b7aef7dc6145a8b67bd691c1 /core/src/test/java/org/elasticsearch
parentcca18a2c356afbe1025d6ba680e126236158a938 (diff)
Remove default path settings
This commit removes the default path settings for data and logs. With this change, we now ship the packages with these settings set in the elasticsearch.yml configuration file rather than going through the default.path.data and default.path.logs dance that we went through in the past. Relates #25408
Diffstat (limited to 'core/src/test/java/org/elasticsearch')
-rw-r--r--core/src/test/java/org/elasticsearch/env/EnvironmentTests.java52
-rw-r--r--core/src/test/java/org/elasticsearch/node/NodeTests.java66
2 files changed, 1 insertions, 117 deletions
diff --git a/core/src/test/java/org/elasticsearch/env/EnvironmentTests.java b/core/src/test/java/org/elasticsearch/env/EnvironmentTests.java
index 7b630b2544..51391a8643 100644
--- a/core/src/test/java/org/elasticsearch/env/EnvironmentTests.java
+++ b/core/src/test/java/org/elasticsearch/env/EnvironmentTests.java
@@ -73,28 +73,6 @@ public class EnvironmentTests extends ESTestCase {
assertThat(environment.resolveRepoURL(new URL("jar:http://localhost/test/../repo1?blah!/repo/")), nullValue());
}
- public void testDefaultPathData() {
- final Path defaultPathData = createTempDir().toAbsolutePath();
- final Settings settings = Settings.builder()
- .put("path.home", createTempDir().toAbsolutePath())
- .put("default.path.data", defaultPathData)
- .build();
- final Environment environment = new Environment(settings);
- assertThat(environment.dataFiles(), equalTo(new Path[] { defaultPathData }));
- }
-
- public void testPathDataOverrideDefaultPathData() {
- final Path pathData = createTempDir().toAbsolutePath();
- final Path defaultPathData = createTempDir().toAbsolutePath();
- final Settings settings = Settings.builder()
- .put("path.home", createTempDir().toAbsolutePath())
- .put("path.data", pathData)
- .put("default.path.data", defaultPathData)
- .build();
- final Environment environment = new Environment(settings);
- assertThat(environment.dataFiles(), equalTo(new Path[] { pathData }));
- }
-
public void testPathDataWhenNotSet() {
final Path pathHome = createTempDir().toAbsolutePath();
final Settings settings = Settings.builder().put("path.home", pathHome).build();
@@ -103,38 +81,10 @@ public class EnvironmentTests extends ESTestCase {
}
public void testPathDataNotSetInEnvironmentIfNotSet() {
- final Path defaultPathData = createTempDir().toAbsolutePath();
- final Settings settings = Settings.builder()
- .put("path.home", createTempDir().toAbsolutePath())
- .put("default.path.data", defaultPathData)
- .build();
+ final Settings settings = Settings.builder().put("path.home", createTempDir().toAbsolutePath()).build();
assertFalse(Environment.PATH_DATA_SETTING.exists(settings));
- assertTrue(Environment.DEFAULT_PATH_DATA_SETTING.exists(settings));
final Environment environment = new Environment(settings);
assertFalse(Environment.PATH_DATA_SETTING.exists(environment.settings()));
- assertTrue(Environment.DEFAULT_PATH_DATA_SETTING.exists(environment.settings()));
- }
-
- public void testDefaultPathLogs() {
- final Path defaultPathLogs = createTempDir().toAbsolutePath();
- final Settings settings = Settings.builder()
- .put("path.home", createTempDir().toAbsolutePath())
- .put("default.path.logs", defaultPathLogs)
- .build();
- final Environment environment = new Environment(settings);
- assertThat(environment.logsFile(), equalTo(defaultPathLogs));
- }
-
- public void testPathLogsOverrideDefaultPathLogs() {
- final Path pathLogs = createTempDir().toAbsolutePath();
- final Path defaultPathLogs = createTempDir().toAbsolutePath();
- final Settings settings = Settings.builder()
- .put("path.home", createTempDir().toAbsolutePath())
- .put("path.logs", pathLogs)
- .put("default.path.logs", defaultPathLogs)
- .build();
- final Environment environment = new Environment(settings);
- assertThat(environment.logsFile(), equalTo(pathLogs));
}
public void testPathLogsWhenNotSet() {
diff --git a/core/src/test/java/org/elasticsearch/node/NodeTests.java b/core/src/test/java/org/elasticsearch/node/NodeTests.java
index 26835370c6..6590def3a7 100644
--- a/core/src/test/java/org/elasticsearch/node/NodeTests.java
+++ b/core/src/test/java/org/elasticsearch/node/NodeTests.java
@@ -163,72 +163,6 @@ public class NodeTests extends ESTestCase {
}
}
- public void testDefaultPathDataSet() throws IOException {
- final Path zero = createTempDir().toAbsolutePath();
- final Path one = createTempDir().toAbsolutePath();
- final Path defaultPathData = createTempDir().toAbsolutePath();
- final Settings settings = Settings.builder()
- .put("path.home", "/home")
- .put("path.data.0", zero)
- .put("path.data.1", one)
- .put("default.path.data", defaultPathData)
- .build();
- try (NodeEnvironment nodeEnv = new NodeEnvironment(settings, new Environment(settings))) {
- final Path defaultPathDataWithNodesAndId = defaultPathData.resolve("nodes/0");
- Files.createDirectories(defaultPathDataWithNodesAndId);
- final NodeEnvironment.NodePath defaultNodePath = new NodeEnvironment.NodePath(defaultPathDataWithNodesAndId);
- final boolean indexExists = randomBoolean();
- final List<String> indices;
- if (indexExists) {
- indices = IntStream.range(0, randomIntBetween(1, 3)).mapToObj(i -> UUIDs.randomBase64UUID()).collect(Collectors.toList());
- for (final String index : indices) {
- Files.createDirectories(defaultNodePath.indicesPath.resolve(index));
- }
- } else {
- indices = Collections.emptyList();
- }
- final Logger mock = mock(Logger.class);
- if (indexExists) {
- final IllegalStateException e = expectThrows(
- IllegalStateException.class,
- () -> Node.checkForIndexDataInDefaultPathData(settings, nodeEnv, mock));
- final String message = String.format(
- Locale.ROOT,
- "detected index data in default.path.data [%s] where there should not be any; check the logs for details",
- defaultPathData);
- assertThat(e, hasToString(containsString(message)));
- verify(mock)
- .error("detected index data in default.path.data [{}] where there should not be any", defaultNodePath.indicesPath);
- for (final String index : indices) {
- verify(mock).info(
- "index folder [{}] in default.path.data [{}] must be moved to any of {}",
- index,
- defaultNodePath.indicesPath,
- Arrays.stream(nodeEnv.nodePaths()).map(np -> np.indicesPath).collect(Collectors.toList()));
- }
- verifyNoMoreInteractions(mock);
- } else {
- Node.checkForIndexDataInDefaultPathData(settings, nodeEnv, mock);
- verifyNoMoreInteractions(mock);
- }
- }
- }
-
- public void testDefaultPathDataNotSet() throws IOException {
- final Path zero = createTempDir().toAbsolutePath();
- final Path one = createTempDir().toAbsolutePath();
- final Settings settings = Settings.builder()
- .put("path.home", "/home")
- .put("path.data.0", zero)
- .put("path.data.1", one)
- .build();
- try (NodeEnvironment nodeEnv = new NodeEnvironment(settings, new Environment(settings))) {
- final Logger mock = mock(Logger.class);
- Node.checkForIndexDataInDefaultPathData(settings, nodeEnv, mock);
- verifyNoMoreInteractions(mock);
- }
- }
-
private static Settings.Builder baseSettings() {
final Path tempDir = createTempDir();
return Settings.builder()