Tests: For single data path for *FieldMapperUpgradeTests.

This commit is contained in:
Adrien Grand 2015-11-25 11:46:19 +01:00
parent e2447c7ce0
commit e8520bf519
2 changed files with 14 additions and 4 deletions

View File

@ -22,6 +22,7 @@ package org.elasticsearch.index.mapper.murmur3;
import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.TestUtil; import org.apache.lucene.util.TestUtil;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.env.NodeEnvironment;
import org.elasticsearch.plugin.mapper.MapperMurmur3Plugin; import org.elasticsearch.plugin.mapper.MapperMurmur3Plugin;
import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.Plugin;
@ -56,10 +57,14 @@ public class Murmur3FieldMapperUpgradeTests extends ESIntegTestCase {
} }
assertTrue(Files.exists(unzipDataDir)); assertTrue(Files.exists(unzipDataDir));
final String node = internalCluster().startNode(); Path dataPath = createTempDir();
Settings settings = Settings.builder()
.put("path.data", dataPath)
.build();
final String node = internalCluster().startNode(settings);
Path[] nodePaths = internalCluster().getInstance(NodeEnvironment.class, node).nodeDataPaths(); Path[] nodePaths = internalCluster().getInstance(NodeEnvironment.class, node).nodeDataPaths();
assertEquals(1, nodePaths.length); assertEquals(1, nodePaths.length);
Path dataPath = nodePaths[0].resolve(NodeEnvironment.INDICES_FOLDER); dataPath = nodePaths[0].resolve(NodeEnvironment.INDICES_FOLDER);
assertFalse(Files.exists(dataPath)); assertFalse(Files.exists(dataPath));
Path src = unzipDataDir.resolve(indexName + "/nodes/0/indices"); Path src = unzipDataDir.resolve(indexName + "/nodes/0/indices");
Files.move(src, dataPath); Files.move(src, dataPath);

View File

@ -22,6 +22,7 @@ package org.elasticsearch.index.mapper.size;
import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.TestUtil; import org.apache.lucene.util.TestUtil;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.env.NodeEnvironment;
import org.elasticsearch.plugin.mapper.MapperSizePlugin; import org.elasticsearch.plugin.mapper.MapperSizePlugin;
import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.Plugin;
@ -57,10 +58,14 @@ public class SizeFieldMapperUpgradeTests extends ESIntegTestCase {
} }
assertTrue(Files.exists(unzipDataDir)); assertTrue(Files.exists(unzipDataDir));
final String node = internalCluster().startNode(); Path dataPath = createTempDir();
Settings settings = Settings.builder()
.put("path.data", dataPath)
.build();
final String node = internalCluster().startNode(settings);
Path[] nodePaths = internalCluster().getInstance(NodeEnvironment.class, node).nodeDataPaths(); Path[] nodePaths = internalCluster().getInstance(NodeEnvironment.class, node).nodeDataPaths();
assertEquals(1, nodePaths.length); assertEquals(1, nodePaths.length);
Path dataPath = nodePaths[0].resolve(NodeEnvironment.INDICES_FOLDER); dataPath = nodePaths[0].resolve(NodeEnvironment.INDICES_FOLDER);
assertFalse(Files.exists(dataPath)); assertFalse(Files.exists(dataPath));
Path src = unzipDataDir.resolve(indexName + "/nodes/0/indices"); Path src = unzipDataDir.resolve(indexName + "/nodes/0/indices");
Files.move(src, dataPath); Files.move(src, dataPath);