nuke duplicate methods
This commit is contained in:
parent
61b60da7d2
commit
a312098785
|
@ -112,7 +112,7 @@ public class OldIndexBackwardsCompatibilityTests extends ElasticsearchIntegratio
|
|||
void setupCluster() throws Exception {
|
||||
ListenableFuture<List<String>> replicas = internalCluster().startNodesAsync(1); // for replicas
|
||||
|
||||
Path baseTempDir = newTempDirPath();
|
||||
Path baseTempDir = createTempDir();
|
||||
// start single data path node
|
||||
ImmutableSettings.Builder nodeSettings = ImmutableSettings.builder()
|
||||
.put("path.data", baseTempDir.resolve("single-path").toAbsolutePath())
|
||||
|
@ -148,7 +148,7 @@ public class OldIndexBackwardsCompatibilityTests extends ElasticsearchIntegratio
|
|||
}
|
||||
|
||||
String loadIndex(String indexFile) throws Exception {
|
||||
Path unzipDir = newTempDirPath();
|
||||
Path unzipDir = createTempDir();
|
||||
Path unzipDataDir = unzipDir.resolve("data");
|
||||
String indexName = indexFile.replace(".zip", "").toLowerCase(Locale.ROOT);
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public class TransportClientTests extends ElasticsearchIntegrationTest {
|
|||
TransportClientNodesService nodeService = client.nodeService();
|
||||
Node node = nodeBuilder().data(false).settings(ImmutableSettings.builder()
|
||||
.put(internalCluster().getDefaultSettings())
|
||||
.put("path.home", newTempDirPath())
|
||||
.put("path.home", createTempDir())
|
||||
.put("node.name", "testNodeVersionIsUpdated")
|
||||
.put("http.enabled", false)
|
||||
.put("index.store.type", "ram")
|
||||
|
|
|
@ -38,7 +38,7 @@ import java.util.Arrays;
|
|||
public class RoutingBackwardCompatibilityTests extends ElasticsearchTestCase {
|
||||
|
||||
public void testBackwardCompatibility() throws Exception {
|
||||
Path baseDir = newTempDirPath();
|
||||
Path baseDir = createTempDir();
|
||||
Node node = new Node(ImmutableSettings.builder().put("path.home", baseDir.toString()).build(), false);
|
||||
try {
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(RoutingBackwardCompatibilityTests.class.getResourceAsStream("/org/elasticsearch/cluster/routing/shard_routes.txt"), "UTF-8"))) {
|
||||
|
|
|
@ -44,7 +44,7 @@ public class BalanceUnbalancedClusterTest extends CatAllocationTestBase {
|
|||
|
||||
@Override
|
||||
protected Path getCatPath() throws IOException {
|
||||
Path tmp = newTempDirPath();
|
||||
Path tmp = createTempDir();
|
||||
try (InputStream stream = Files.newInputStream(getDataPath("/org/elasticsearch/cluster/routing/issue_9023.zip"))) {
|
||||
TestUtil.unzip(stream, tmp);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class ChannelsTests extends ElasticsearchTestCase {
|
|||
@Before
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
Path tmpFile = newTempFilePath();
|
||||
Path tmpFile = createTempFile();
|
||||
FileChannel randomAccessFile = FileChannel.open(tmpFile, StandardOpenOption.READ, StandardOpenOption.WRITE);
|
||||
fileChannel = new MockFileChannel(randomAccessFile);
|
||||
randomBytes = randomUnicodeOfLength(scaledRandomIntBetween(10, 100000)).getBytes("UTF-8");
|
||||
|
|
|
@ -37,7 +37,7 @@ public class PidFileTests extends ElasticsearchTestCase {
|
|||
|
||||
@Test(expected = ElasticsearchIllegalArgumentException.class)
|
||||
public void testParentIsFile() throws IOException {
|
||||
Path dir = newTempDirPath();
|
||||
Path dir = createTempDir();
|
||||
Path parent = dir.resolve("foo");
|
||||
try(BufferedWriter stream = Files.newBufferedWriter(parent, Charsets.UTF_8, StandardOpenOption.CREATE_NEW)) {
|
||||
stream.write("foo");
|
||||
|
@ -48,7 +48,7 @@ public class PidFileTests extends ElasticsearchTestCase {
|
|||
|
||||
@Test
|
||||
public void testPidFile() throws IOException {
|
||||
Path dir = newTempDirPath();
|
||||
Path dir = createTempDir();
|
||||
Path parent = dir.resolve("foo");
|
||||
if (randomBoolean()) {
|
||||
Files.createDirectories(parent);
|
||||
|
|
|
@ -141,7 +141,7 @@ public class BlobStoreTest extends ElasticsearchTestCase {
|
|||
}
|
||||
|
||||
protected BlobStore newBlobStore() throws IOException {
|
||||
Path tempDir = newTempDirPath();
|
||||
Path tempDir = createTempDir();
|
||||
Settings settings = randomBoolean() ? ImmutableSettings.EMPTY : ImmutableSettings.builder().put("buffer_size", new ByteSizeValue(randomIntBetween(1, 100), ByteSizeUnit.KB)).build();
|
||||
FsBlobStore store = new FsBlobStore(settings, tempDir);
|
||||
return store;
|
||||
|
|
|
@ -263,7 +263,7 @@ public class PagedBytesReferenceTest extends ElasticsearchTestCase {
|
|||
public void testWriteToChannel() throws IOException {
|
||||
int length = randomIntBetween(10, PAGE_SIZE * 4);
|
||||
BytesReference pbr = getRandomizedPagedBytesReference(length);
|
||||
Path tFile = newTempFilePath();
|
||||
Path tFile = createTempFile();
|
||||
try (FileChannel channel = FileChannel.open(tFile, StandardOpenOption.WRITE)) {
|
||||
pbr.writeTo(channel);
|
||||
assertEquals(pbr.length(), channel.position());
|
||||
|
@ -290,7 +290,7 @@ public class PagedBytesReferenceTest extends ElasticsearchTestCase {
|
|||
int sliceOffset = randomIntBetween(1, length / 2);
|
||||
int sliceLength = length - sliceOffset;
|
||||
BytesReference slice = pbr.slice(sliceOffset, sliceLength);
|
||||
Path tFile = newTempFilePath();
|
||||
Path tFile = createTempFile();
|
||||
try (FileChannel channel = FileChannel.open(tFile, StandardOpenOption.WRITE)) {
|
||||
slice.writeTo(channel);
|
||||
assertEquals(slice.length(), channel.position());
|
||||
|
|
|
@ -49,8 +49,8 @@ public class FileSystemUtilsTests extends ElasticsearchTestCase {
|
|||
|
||||
@Before
|
||||
public void copySourceFilesToTarget() throws IOException, URISyntaxException {
|
||||
src = newTempDirPath();
|
||||
dst = newTempDirPath();
|
||||
src = createTempDir();
|
||||
dst = createTempDir();
|
||||
Files.createDirectories(src);
|
||||
Files.createDirectories(dst);
|
||||
|
||||
|
@ -89,7 +89,7 @@ public class FileSystemUtilsTests extends ElasticsearchTestCase {
|
|||
|
||||
@Test
|
||||
public void testMoveOverExistingFileAndIgnore() throws IOException {
|
||||
Path dest = newTempDirPath();
|
||||
Path dest = createTempDir();
|
||||
|
||||
FileSystemUtils.moveFilesWithoutOverwriting(src.resolve("v1"), dest, null);
|
||||
assertFileContent(dest, "file1.txt", "version1");
|
||||
|
@ -117,7 +117,7 @@ public class FileSystemUtilsTests extends ElasticsearchTestCase {
|
|||
|
||||
@Test
|
||||
public void testMoveFilesDoesNotCreateSameFileWithSuffix() throws Exception {
|
||||
Path[] dirs = new Path[] { newTempDirPath(), newTempDirPath(), newTempDirPath()};
|
||||
Path[] dirs = new Path[] { createTempDir(), createTempDir(), createTempDir()};
|
||||
for (Path dir : dirs) {
|
||||
Files.write(dir.resolve("file1.txt"), "file1".getBytes(Charsets.UTF_8));
|
||||
Files.createDirectory(dir.resolve("dir"));
|
||||
|
|
|
@ -83,7 +83,7 @@ public class LoggingConfigurationTests extends ElasticsearchTestCase {
|
|||
|
||||
@Test
|
||||
public void testResolveJsonLoggingConfig() throws Exception {
|
||||
Path tmpDir = newTempDirPath();
|
||||
Path tmpDir = createTempDir();
|
||||
Path loggingConf = tmpDir.resolve(loggingConfiguration("json"));
|
||||
Files.write(loggingConf, "{\"json\": \"foo\"}".getBytes(StandardCharsets.UTF_8));
|
||||
Environment environment = new Environment(
|
||||
|
@ -98,7 +98,7 @@ public class LoggingConfigurationTests extends ElasticsearchTestCase {
|
|||
|
||||
@Test
|
||||
public void testResolvePropertiesLoggingConfig() throws Exception {
|
||||
Path tmpDir = newTempDirPath();
|
||||
Path tmpDir = createTempDir();
|
||||
Path loggingConf = tmpDir.resolve(loggingConfiguration("properties"));
|
||||
Files.write(loggingConf, "key: value".getBytes(StandardCharsets.UTF_8));
|
||||
Environment environment = new Environment(
|
||||
|
@ -113,7 +113,7 @@ public class LoggingConfigurationTests extends ElasticsearchTestCase {
|
|||
|
||||
@Test
|
||||
public void testResolveYamlLoggingConfig() throws Exception {
|
||||
Path tmpDir = newTempDirPath();
|
||||
Path tmpDir = createTempDir();
|
||||
Path loggingConf1 = tmpDir.resolve(loggingConfiguration("yml"));
|
||||
Path loggingConf2 = tmpDir.resolve(loggingConfiguration("yaml"));
|
||||
Files.write(loggingConf1, "yml: bar".getBytes(StandardCharsets.UTF_8));
|
||||
|
@ -131,7 +131,7 @@ public class LoggingConfigurationTests extends ElasticsearchTestCase {
|
|||
|
||||
@Test
|
||||
public void testResolveConfigInvalidFilename() throws Exception {
|
||||
Path tmpDir = newTempDirPath();
|
||||
Path tmpDir = createTempDir();
|
||||
Path invalidSuffix = tmpDir.resolve(loggingConfiguration(randomFrom(LogConfigurator.ALLOWED_SUFFIXES)) + randomInvalidSuffix());
|
||||
Files.write(invalidSuffix, "yml: bar".getBytes(StandardCharsets.UTF_8));
|
||||
Environment environment = new Environment(
|
||||
|
|
|
@ -42,7 +42,7 @@ public class EnvironmentTests extends ElasticsearchTestCase {
|
|||
public Environment newEnvironment(Settings settings) throws IOException {
|
||||
Settings build = ImmutableSettings.builder()
|
||||
.put(settings)
|
||||
.put("path.home", newTempDirPath().toAbsolutePath())
|
||||
.put("path.home", createTempDir().toAbsolutePath())
|
||||
.putArray("path.data", tmpPaths()).build();
|
||||
return new Environment(build);
|
||||
}
|
||||
|
|
|
@ -355,7 +355,7 @@ public class NodeEnvironmentTests extends ElasticsearchTestCase {
|
|||
final int numPaths = randomIntBetween(1, 3);
|
||||
final String[] absPaths = new String[numPaths];
|
||||
for (int i = 0; i < numPaths; i++) {
|
||||
absPaths[i] = newTempDirPath().toAbsolutePath().toString();
|
||||
absPaths[i] = createTempDir().toAbsolutePath().toString();
|
||||
}
|
||||
return absPaths;
|
||||
}
|
||||
|
@ -369,7 +369,7 @@ public class NodeEnvironmentTests extends ElasticsearchTestCase {
|
|||
public NodeEnvironment newNodeEnvironment(Settings settings) throws IOException {
|
||||
Settings build = ImmutableSettings.builder()
|
||||
.put(settings)
|
||||
.put("path.home", newTempDirPath().toAbsolutePath().toString())
|
||||
.put("path.home", createTempDir().toAbsolutePath().toString())
|
||||
.put(NodeEnvironment.SETTING_CUSTOM_DATA_PATH_ENABLED, true)
|
||||
.putArray("path.data", tmpPaths()).build();
|
||||
return new NodeEnvironment(build, new Environment(build));
|
||||
|
@ -378,7 +378,7 @@ public class NodeEnvironmentTests extends ElasticsearchTestCase {
|
|||
public NodeEnvironment newNodeEnvironment(String[] dataPaths, Settings settings) throws IOException {
|
||||
Settings build = ImmutableSettings.builder()
|
||||
.put(settings)
|
||||
.put("path.home", newTempDirPath().toAbsolutePath().toString())
|
||||
.put("path.home", createTempDir().toAbsolutePath().toString())
|
||||
.put(NodeEnvironment.SETTING_CUSTOM_DATA_PATH_ENABLED, true)
|
||||
.putArray("path.data", dataPaths).build();
|
||||
return new NodeEnvironment(build, new Environment(build));
|
||||
|
|
|
@ -92,7 +92,7 @@ public class MetaDataStateFormatTest extends ElasticsearchTestCase {
|
|||
return MetaData.Builder.fromXContent(parser);
|
||||
}
|
||||
};
|
||||
Path tmp = newTempDirPath();
|
||||
Path tmp = createTempDir();
|
||||
final InputStream resource = this.getClass().getResourceAsStream("global-3.st");
|
||||
assertThat(resource, notNullValue());
|
||||
Path dst = tmp.resolve("global-3.st");
|
||||
|
@ -106,7 +106,7 @@ public class MetaDataStateFormatTest extends ElasticsearchTestCase {
|
|||
public void testReadWriteState() throws IOException {
|
||||
Path[] dirs = new Path[randomIntBetween(1, 5)];
|
||||
for (int i = 0; i < dirs.length; i++) {
|
||||
dirs[i] = newTempDirPath();
|
||||
dirs[i] = createTempDir();
|
||||
}
|
||||
final long id = addDummyFiles("foo-", dirs);
|
||||
Format format = new Format(randomFrom(XContentType.values()), "foo-");
|
||||
|
@ -148,7 +148,7 @@ public class MetaDataStateFormatTest extends ElasticsearchTestCase {
|
|||
public void testVersionMismatch() throws IOException {
|
||||
Path[] dirs = new Path[randomIntBetween(1, 5)];
|
||||
for (int i = 0; i < dirs.length; i++) {
|
||||
dirs[i] = newTempDirPath();
|
||||
dirs[i] = createTempDir();
|
||||
}
|
||||
final long id = addDummyFiles("foo-", dirs);
|
||||
|
||||
|
@ -173,7 +173,7 @@ public class MetaDataStateFormatTest extends ElasticsearchTestCase {
|
|||
public void testCorruption() throws IOException {
|
||||
Path[] dirs = new Path[randomIntBetween(1, 5)];
|
||||
for (int i = 0; i < dirs.length; i++) {
|
||||
dirs[i] = newTempDirPath();
|
||||
dirs[i] = createTempDir();
|
||||
}
|
||||
final long id = addDummyFiles("foo-", dirs);
|
||||
Format format = new Format(randomFrom(XContentType.values()), "foo-");
|
||||
|
@ -247,8 +247,8 @@ public class MetaDataStateFormatTest extends ElasticsearchTestCase {
|
|||
final ToXContent.Params params = ToXContent.EMPTY_PARAMS;
|
||||
MetaDataStateFormat<MetaData> format = MetaStateService.globalStateFormat(randomFrom(XContentType.values()), params);
|
||||
final Path[] dirs = new Path[2];
|
||||
dirs[0] = newTempDirPath();
|
||||
dirs[1] = newTempDirPath();
|
||||
dirs[0] = createTempDir();
|
||||
dirs[1] = createTempDir();
|
||||
for (Path dir : dirs) {
|
||||
Files.createDirectories(dir.resolve(MetaDataStateFormat.STATE_DIR_NAME));
|
||||
}
|
||||
|
@ -292,8 +292,8 @@ public class MetaDataStateFormatTest extends ElasticsearchTestCase {
|
|||
final ToXContent.Params params = ToXContent.EMPTY_PARAMS;
|
||||
MetaDataStateFormat<MetaData> format = MetaStateService.globalStateFormat(randomFrom(XContentType.values()), params);
|
||||
final Path[] dirs = new Path[2];
|
||||
dirs[0] = newTempDirPath();
|
||||
dirs[1] = newTempDirPath();
|
||||
dirs[0] = createTempDir();
|
||||
dirs[1] = createTempDir();
|
||||
for (Path dir : dirs) {
|
||||
Files.createDirectories(dir.resolve(MetaDataStateFormat.STATE_DIR_NAME));
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ public class MetaDataStateFormatTest extends ElasticsearchTestCase {
|
|||
Set<Path> corruptedFiles = new HashSet<>();
|
||||
MetaDataStateFormat<MetaData> format = MetaStateService.globalStateFormat(randomFrom(XContentType.values()), params);
|
||||
for (int i = 0; i < dirs.length; i++) {
|
||||
dirs[i] = newTempDirPath();
|
||||
dirs[i] = createTempDir();
|
||||
Files.createDirectories(dirs[i].resolve(MetaDataStateFormat.STATE_DIR_NAME));
|
||||
for (int j = 0; j < numLegacy; j++) {
|
||||
XContentType type = format.format();
|
||||
|
|
|
@ -438,11 +438,11 @@ public class RecoveryFromGatewayTests extends ElasticsearchIntegrationTest {
|
|||
public void testRecoveryDifferentNodeOrderStartup() throws Exception {
|
||||
// we need different data paths so we make sure we start the second node fresh
|
||||
|
||||
final String node_1 = internalCluster().startNode(settingsBuilder().put("path.data", newTempDirPath()).build());
|
||||
final String node_1 = internalCluster().startNode(settingsBuilder().put("path.data", createTempDir()).build());
|
||||
|
||||
client().prepareIndex("test", "type1", "1").setSource("field", "value").execute().actionGet();
|
||||
|
||||
internalCluster().startNode(settingsBuilder().put("path.data", newTempDirPath()).build());
|
||||
internalCluster().startNode(settingsBuilder().put("path.data", createTempDir()).build());
|
||||
|
||||
ensureGreen();
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest {
|
|||
.build();
|
||||
|
||||
internalCluster().startNodesAsync(3, nodeSettings).get();
|
||||
final Path dataPath = newTempDirPath();
|
||||
final Path dataPath = createTempDir();
|
||||
Settings idxSettings = ImmutableSettings.builder()
|
||||
.put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0).build();
|
||||
|
@ -82,7 +82,7 @@ public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
assertAcked(client().admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder()
|
||||
.put("location", newTempDirPath())));
|
||||
.put("location", createTempDir())));
|
||||
CreateSnapshotResponse createSnapshotResponse = client().admin().cluster().prepareCreateSnapshot("test-repo", "test-snap").setWaitForCompletion(true).setIndices("foo").get();
|
||||
assertThat(createSnapshotResponse.getSnapshotInfo().successfulShards(), greaterThan(0));
|
||||
assertThat(createSnapshotResponse.getSnapshotInfo().successfulShards(), equalTo(createSnapshotResponse.getSnapshotInfo().totalShards()));
|
||||
|
@ -128,7 +128,7 @@ public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
internalCluster().startNodesAsync(3, nodeSettings).get();
|
||||
final String IDX = "test";
|
||||
final Path dataPath = newTempDirPath();
|
||||
final Path dataPath = createTempDir();
|
||||
|
||||
Settings idxSettings = ImmutableSettings.builder()
|
||||
.put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1)
|
||||
|
@ -193,7 +193,7 @@ public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest {
|
|||
.build();
|
||||
|
||||
String node1 = internalCluster().startNode(nodeSettings);
|
||||
Path dataPath = newTempDirPath();
|
||||
Path dataPath = createTempDir();
|
||||
String IDX = "test";
|
||||
|
||||
Settings idxSettings = ImmutableSettings.builder()
|
||||
|
@ -255,7 +255,7 @@ public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest {
|
|||
.build();
|
||||
|
||||
String node1 = internalCluster().startNode(nodeSettings);
|
||||
Path dataPath = newTempDirPath();
|
||||
Path dataPath = createTempDir();
|
||||
String IDX = "test";
|
||||
|
||||
Settings idxSettings = ImmutableSettings.builder()
|
||||
|
@ -320,7 +320,7 @@ public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
int nodeCount = randomIntBetween(2, 5);
|
||||
internalCluster().startNodesAsync(nodeCount, nodeSettings).get();
|
||||
Path dataPath = newTempDirPath();
|
||||
Path dataPath = createTempDir();
|
||||
String IDX = "test";
|
||||
|
||||
Settings idxSettings = ImmutableSettings.builder()
|
||||
|
@ -364,7 +364,7 @@ public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest {
|
|||
.build();
|
||||
|
||||
internalCluster().startNodesAsync(2, nodeSettings).get();
|
||||
Path dataPath = newTempDirPath();
|
||||
Path dataPath = createTempDir();
|
||||
String IDX = "test";
|
||||
|
||||
Settings idxSettings = ImmutableSettings.builder()
|
||||
|
@ -421,7 +421,7 @@ public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest {
|
|||
.build();
|
||||
|
||||
internalCluster().startNodesAsync(3, nodeSettings).get();
|
||||
Path dataPath = newTempDirPath();
|
||||
Path dataPath = createTempDir();
|
||||
String IDX = "test";
|
||||
|
||||
Settings idxSettings = ImmutableSettings.builder()
|
||||
|
|
|
@ -212,7 +212,7 @@ public class AnalysisModuleTests extends ElasticsearchTestCase {
|
|||
}
|
||||
|
||||
private Path generateWordList(String[] words) throws Exception {
|
||||
Path wordListFile = newTempDirPath().resolve("wordlist.txt");
|
||||
Path wordListFile = createTempDir().resolve("wordlist.txt");
|
||||
try (BufferedWriter writer = Files.newBufferedWriter(wordListFile, StandardCharsets.UTF_8)) {
|
||||
for (String word : words) {
|
||||
writer.write(word);
|
||||
|
|
|
@ -45,7 +45,7 @@ public class FileBasedMappingsTests extends ElasticsearchTestCase {
|
|||
private static final String NAME = FileBasedMappingsTests.class.getSimpleName();
|
||||
|
||||
public void testFileBasedMappings() throws Exception {
|
||||
Path configDir = newTempDirPath();
|
||||
Path configDir = createTempDir();
|
||||
Path mappingsDir = configDir.resolve("mappings");
|
||||
Path indexMappings = mappingsDir.resolve("index").resolve("type.json");
|
||||
Path defaultMappings = mappingsDir.resolve("_default").resolve("type.json");
|
||||
|
@ -82,7 +82,7 @@ public class FileBasedMappingsTests extends ElasticsearchTestCase {
|
|||
Settings settings = ImmutableSettings.builder()
|
||||
.put(ClusterName.SETTING, NAME)
|
||||
.put("node.name", NAME)
|
||||
.put("path.home", newTempDirPath())
|
||||
.put("path.home", createTempDir())
|
||||
.put("path.conf", configDir.toAbsolutePath())
|
||||
.put("http.enabled", false)
|
||||
.build();
|
||||
|
|
|
@ -486,7 +486,7 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest {
|
|||
logger.info("--> creating repository");
|
||||
assertAcked(client().admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(settingsBuilder()
|
||||
.put("location", newTempDirPath().toAbsolutePath())
|
||||
.put("location", createTempDir().toAbsolutePath())
|
||||
.put("compress", randomBoolean())
|
||||
.put("chunk_size", randomIntBetween(100, 1000))));
|
||||
logger.info("--> snapshot");
|
||||
|
|
|
@ -165,7 +165,7 @@ public class DistributorTests extends ElasticsearchTestCase {
|
|||
|
||||
|
||||
public FakeFsDirectory(String path, long usableSpace) throws IOException {
|
||||
super(newTempDirPath().resolve(path), NoLockFactory.INSTANCE);
|
||||
super(createTempDir().resolve(path), NoLockFactory.INSTANCE);
|
||||
allocationCount = 0;
|
||||
this.useableSpace = usableSpace;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ public abstract class AbstractSimpleTranslogTests extends ElasticsearchTestCase
|
|||
@Before
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
translogDir = newTempDirPath();
|
||||
translogDir = createTempDir();
|
||||
translog = create(translogDir);
|
||||
translog.newTranslog(1);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class IndicesCustomDataPathTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
@Before
|
||||
public void setup() {
|
||||
path = newTempDirPath().toAbsolutePath().toString();
|
||||
path = createTempDir().toAbsolutePath().toString();
|
||||
}
|
||||
|
||||
@After
|
||||
|
@ -63,7 +63,7 @@ public class IndicesCustomDataPathTests extends ElasticsearchIntegrationTest {
|
|||
@TestLogging("_root:DEBUG,index:TRACE")
|
||||
public void testDataPathCanBeChanged() throws Exception {
|
||||
final String INDEX = "idx";
|
||||
Path root = newTempDirPath();
|
||||
Path root = createTempDir();
|
||||
Path startDir = root.resolve("start");
|
||||
Path endDir = root.resolve("end");
|
||||
logger.info("--> start dir: [{}]", startDir.toAbsolutePath().toString());
|
||||
|
|
|
@ -49,7 +49,7 @@ public class IndexTemplateFileLoadingTests extends ElasticsearchIntegrationTest
|
|||
settingsBuilder.put(super.nodeSettings(nodeOrdinal));
|
||||
|
||||
try {
|
||||
Path directory = newTempDirPath();
|
||||
Path directory = createTempDir();
|
||||
settingsBuilder.put("path.conf", directory.toAbsolutePath());
|
||||
|
||||
Path templatesDir = directory.resolve("templates");
|
||||
|
|
|
@ -287,7 +287,7 @@ public class PluginManagerTests extends ElasticsearchIntegrationTest {
|
|||
Settings settings = ImmutableSettings.settingsBuilder()
|
||||
.put("discovery.zen.ping.multicast.enabled", false)
|
||||
.put("http.enabled", true)
|
||||
.put("path.home", newTempDirPath()).build();
|
||||
.put("path.home", createTempDir()).build();
|
||||
return InternalSettingsPreparer.prepareSettings(settings, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,8 +40,8 @@ public class PluginManagerUnitTests extends ElasticsearchTestCase {
|
|||
@Test
|
||||
public void testThatConfigDirectoryCanBeOutsideOfElasticsearchHomeDirectory() throws IOException {
|
||||
String pluginName = randomAsciiOfLength(10);
|
||||
Path homeFolder = newTempDirPath();
|
||||
Path genericConfigFolder = newTempDirPath();
|
||||
Path homeFolder = createTempDir();
|
||||
Path genericConfigFolder = createTempDir();
|
||||
|
||||
Settings settings = settingsBuilder()
|
||||
.put("path.conf", genericConfigFolder)
|
||||
|
|
|
@ -69,7 +69,7 @@ public class ScriptServiceTests extends ElasticsearchTestCase {
|
|||
|
||||
@Before
|
||||
public void setup() throws IOException {
|
||||
Path genericConfigFolder = newTempDirPath();
|
||||
Path genericConfigFolder = createTempDir();
|
||||
baseSettings = settingsBuilder()
|
||||
.put("path.conf", genericConfigFolder)
|
||||
.build();
|
||||
|
|
|
@ -113,7 +113,7 @@ public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests
|
|||
|
||||
logger.info("--> create repository");
|
||||
PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", newTempDirPath())).execute().actionGet();
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", createTempDir())).execute().actionGet();
|
||||
assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true));
|
||||
|
||||
logger.info("--> start snapshot");
|
||||
|
@ -146,7 +146,7 @@ public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests
|
|||
|
||||
@Test
|
||||
public void restoreCustomMetadata() throws Exception {
|
||||
Path tempDir = newTempDirPath();
|
||||
Path tempDir = createTempDir();
|
||||
|
||||
logger.info("--> start node");
|
||||
internalCluster().startNode();
|
||||
|
@ -293,7 +293,7 @@ public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests
|
|||
PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType(MockRepositoryModule.class.getCanonicalName()).setSettings(
|
||||
ImmutableSettings.settingsBuilder()
|
||||
.put("location", newTempDirPath())
|
||||
.put("location", createTempDir())
|
||||
.put("random", randomAsciiOfLength(10))
|
||||
.put("wait_after_unblock", 200)
|
||||
).get();
|
||||
|
@ -338,7 +338,7 @@ public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests
|
|||
assertThat(client.prepareCount("test-idx").get().getCount(), equalTo(100L));
|
||||
|
||||
logger.info("--> creating repository");
|
||||
Path repo = newTempDirPath();
|
||||
Path repo = createTempDir();
|
||||
PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType(MockRepositoryModule.class.getCanonicalName()).setSettings(
|
||||
ImmutableSettings.settingsBuilder()
|
||||
|
@ -427,7 +427,7 @@ public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests
|
|||
logger.info("--> create repository");
|
||||
logger.info("--> creating repository");
|
||||
PutRepositoryResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", newTempDirPath())).execute().actionGet();
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", createTempDir())).execute().actionGet();
|
||||
assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true));
|
||||
|
||||
logger.info("--> start snapshot with default settings - should fail");
|
||||
|
@ -530,7 +530,7 @@ public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests
|
|||
|
||||
logger.info("--> create repository");
|
||||
PutRepositoryResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", newTempDirPath())).execute().actionGet();
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", createTempDir())).execute().actionGet();
|
||||
assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true));
|
||||
int numberOfShards = 6;
|
||||
logger.info("--> create an index that will have some unallocated shards");
|
||||
|
@ -589,12 +589,12 @@ public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests
|
|||
for (int i = 0; i < 5; i++) {
|
||||
client().admin().cluster().preparePutRepository("test-repo" + i)
|
||||
.setType("mock").setSettings(ImmutableSettings.settingsBuilder()
|
||||
.put("location", newTempDirPath())).setVerify(false).get();
|
||||
.put("location", createTempDir())).setVerify(false).get();
|
||||
}
|
||||
logger.info("--> make sure that properly setup repository can be registered on all nodes");
|
||||
client().admin().cluster().preparePutRepository("test-repo-0")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder()
|
||||
.put("location", newTempDirPath())).get();
|
||||
.put("location", createTempDir())).get();
|
||||
|
||||
}
|
||||
|
||||
|
@ -612,7 +612,7 @@ public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests
|
|||
logger.info("--> creating repository");
|
||||
assertAcked(client().admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder()
|
||||
.put("location", newTempDirPath())
|
||||
.put("location", createTempDir())
|
||||
.put("compress", randomBoolean())
|
||||
.put("chunk_size", randomIntBetween(100, 1000))));
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public class RepositoriesTests extends AbstractSnapshotTests {
|
|||
public void testRepositoryCreation() throws Exception {
|
||||
Client client = client();
|
||||
|
||||
Path location = newTempDirPath();
|
||||
Path location = createTempDir();
|
||||
|
||||
logger.info("--> creating repository");
|
||||
PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo-1")
|
||||
|
@ -82,7 +82,7 @@ public class RepositoriesTests extends AbstractSnapshotTests {
|
|||
logger.info("--> creating another repository");
|
||||
putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo-2")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder()
|
||||
.put("location", newTempDirPath())
|
||||
.put("location", createTempDir())
|
||||
).get();
|
||||
assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true));
|
||||
|
||||
|
@ -142,7 +142,7 @@ public class RepositoriesTests extends AbstractSnapshotTests {
|
|||
logger.info("--> creating repository test-repo-1 with 0s timeout - shouldn't ack");
|
||||
PutRepositoryResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("test-repo-1")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder()
|
||||
.put("location", newTempDirPath())
|
||||
.put("location", createTempDir())
|
||||
.put("compress", randomBoolean())
|
||||
.put("chunk_size", randomIntBetween(5, 100))
|
||||
)
|
||||
|
@ -152,7 +152,7 @@ public class RepositoriesTests extends AbstractSnapshotTests {
|
|||
logger.info("--> creating repository test-repo-2 with standard timeout - should ack");
|
||||
putRepositoryResponse = client().admin().cluster().preparePutRepository("test-repo-2")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder()
|
||||
.put("location", newTempDirPath())
|
||||
.put("location", createTempDir())
|
||||
.put("compress", randomBoolean())
|
||||
.put("chunk_size", randomIntBetween(5, 100))
|
||||
).get();
|
||||
|
@ -173,7 +173,7 @@ public class RepositoriesTests extends AbstractSnapshotTests {
|
|||
Client client = client();
|
||||
|
||||
Settings settings = ImmutableSettings.settingsBuilder()
|
||||
.put("location", newTempDirPath())
|
||||
.put("location", createTempDir())
|
||||
.put("random_control_io_exception_rate", 1.0).build();
|
||||
logger.info("--> creating repository that cannot write any files - should fail");
|
||||
assertThrows(client.admin().cluster().preparePutRepository("test-repo-1")
|
||||
|
@ -187,7 +187,7 @@ public class RepositoriesTests extends AbstractSnapshotTests {
|
|||
logger.info("--> verifying repository");
|
||||
assertThrows(client.admin().cluster().prepareVerifyRepository("test-repo-1"), RepositoryVerificationException.class);
|
||||
|
||||
Path location = newTempDirPath();
|
||||
Path location = createTempDir();
|
||||
|
||||
logger.info("--> creating repository");
|
||||
try {
|
||||
|
@ -208,7 +208,7 @@ public class RepositoriesTests extends AbstractSnapshotTests {
|
|||
Client client = client();
|
||||
|
||||
Settings settings = ImmutableSettings.settingsBuilder()
|
||||
.put("location", newTempDirPath())
|
||||
.put("location", createTempDir())
|
||||
.put("random_control_io_exception_rate", 1.0).build();
|
||||
logger.info("--> creating repository that cannot write any files - should fail");
|
||||
assertThrows(client.admin().cluster().preparePutRepository("test-repo-1")
|
||||
|
@ -222,7 +222,7 @@ public class RepositoriesTests extends AbstractSnapshotTests {
|
|||
logger.info("--> verifying repository");
|
||||
assertThrows(client.admin().cluster().prepareVerifyRepository("test-repo-1"), RepositoryVerificationException.class);
|
||||
|
||||
Path location = newTempDirPath();
|
||||
Path location = createTempDir();
|
||||
|
||||
logger.info("--> creating repository");
|
||||
try {
|
||||
|
|
|
@ -87,7 +87,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
logger.info("--> creating repository");
|
||||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder()
|
||||
.put("location", newTempDirPath())
|
||||
.put("location", createTempDir())
|
||||
.put("compress", randomBoolean())
|
||||
.put("chunk_size", randomIntBetween(100, 1000))));
|
||||
|
||||
|
@ -182,7 +182,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
String indexName = "testindex";
|
||||
String repoName = "test-restore-snapshot-repo";
|
||||
String snapshotName = "test-restore-snapshot";
|
||||
String absolutePath = newTempDirPath().toAbsolutePath().toString();
|
||||
String absolutePath = createTempDir().toAbsolutePath().toString();
|
||||
logger.info("Path [{}]", absolutePath);
|
||||
String restoredIndexName = indexName + "-restored";
|
||||
String typeName = "actions";
|
||||
|
@ -228,7 +228,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
logger.info("--> creating repository");
|
||||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder()
|
||||
.put("location", newTempDirPath())
|
||||
.put("location", createTempDir())
|
||||
.put("compress", randomBoolean())
|
||||
.put("chunk_size", randomIntBetween(100, 1000))));
|
||||
|
||||
|
@ -277,7 +277,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
logger.info("--> creating repository");
|
||||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder()
|
||||
.put("location", newTempDirPath())
|
||||
.put("location", createTempDir())
|
||||
.put("compress", randomBoolean())
|
||||
.put("chunk_size", randomIntBetween(100, 1000))));
|
||||
|
||||
|
@ -325,7 +325,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
|
||||
logger.info("--> creating repository");
|
||||
PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", newTempDirPath())).get();
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", createTempDir())).get();
|
||||
assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true));
|
||||
|
||||
logger.info("--> snapshot");
|
||||
|
@ -342,7 +342,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
|
||||
logger.info("--> creating repository");
|
||||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", newTempDirPath())));
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", createTempDir())));
|
||||
|
||||
logger.info("--> create test indices");
|
||||
createIndex("test-idx-1", "test-idx-2", "test-idx-3");
|
||||
|
@ -398,7 +398,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
|
||||
logger.info("--> creating repository");
|
||||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", newTempDirPath())));
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", createTempDir())));
|
||||
|
||||
logger.info("--> creating test template");
|
||||
assertThat(client.admin().indices().preparePutTemplate("test-template").setTemplate("te*").addMapping("test-mapping", "{}").get().isAcknowledged(), equalTo(true));
|
||||
|
@ -430,7 +430,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
Client client = client();
|
||||
|
||||
logger.info("--> creating repository");
|
||||
Path location = newTempDirPath();
|
||||
Path location = createTempDir();
|
||||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", location)));
|
||||
|
||||
|
@ -512,7 +512,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType(MockRepositoryModule.class.getCanonicalName()).setSettings(
|
||||
ImmutableSettings.settingsBuilder()
|
||||
.put("location", newTempDirPath())
|
||||
.put("location", createTempDir())
|
||||
.put("random", randomAsciiOfLength(10))
|
||||
.put("random_control_io_exception_rate", 0.2))
|
||||
.setVerify(false));
|
||||
|
@ -562,7 +562,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType(MockRepositoryModule.class.getCanonicalName()).setSettings(
|
||||
ImmutableSettings.settingsBuilder()
|
||||
.put("location", newTempDirPath())
|
||||
.put("location", createTempDir())
|
||||
.put("random", randomAsciiOfLength(10))
|
||||
.put("random_data_file_io_exception_rate", 0.3)));
|
||||
|
||||
|
@ -624,7 +624,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
|
||||
@Test
|
||||
public void dataFileFailureDuringRestoreTest() throws Exception {
|
||||
Path repositoryLocation = newTempDirPath();
|
||||
Path repositoryLocation = createTempDir();
|
||||
Client client = client();
|
||||
logger.info("--> creating repository");
|
||||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
|
@ -666,7 +666,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
|
||||
@Test
|
||||
public void deletionOfFailingToRecoverIndexShouldStopRestore() throws Exception {
|
||||
Path repositoryLocation = newTempDirPath();
|
||||
Path repositoryLocation = createTempDir();
|
||||
Client client = client();
|
||||
logger.info("--> creating repository");
|
||||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
|
@ -735,7 +735,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
logger.info("--> creating repository");
|
||||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder()
|
||||
.put("location", newTempDirPath())));
|
||||
.put("location", createTempDir())));
|
||||
|
||||
logger.info("--> creating index that cannot be allocated");
|
||||
prepareCreate("test-idx", 2, ImmutableSettings.builder().put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + ".tag", "nowhere").put("index.number_of_shards", 3)).get();
|
||||
|
@ -753,7 +753,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
final int numberOfSnapshots = between(5, 15);
|
||||
Client client = client();
|
||||
|
||||
Path repo = newTempDirPath();
|
||||
Path repo = createTempDir();
|
||||
logger.info("--> creating repository at " + repo.toAbsolutePath());
|
||||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder()
|
||||
|
@ -810,7 +810,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
public void deleteSnapshotWithMissingIndexAndShardMetadataTest() throws Exception {
|
||||
Client client = client();
|
||||
|
||||
Path repo = newTempDirPath();
|
||||
Path repo = createTempDir();
|
||||
logger.info("--> creating repository at " + repo.toAbsolutePath());
|
||||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder()
|
||||
|
@ -849,7 +849,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
public void deleteSnapshotWithMissingMetadataTest() throws Exception {
|
||||
Client client = client();
|
||||
|
||||
Path repo = newTempDirPath();
|
||||
Path repo = createTempDir();
|
||||
logger.info("--> creating repository at " + repo.toAbsolutePath());
|
||||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder()
|
||||
|
@ -884,7 +884,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
public void deleteSnapshotWithCorruptedSnapshotFileTest() throws Exception {
|
||||
Client client = client();
|
||||
|
||||
Path repo = newTempDirPath();
|
||||
Path repo = createTempDir();
|
||||
logger.info("--> creating repository at " + repo.toAbsolutePath());
|
||||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder()
|
||||
|
@ -929,7 +929,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
logger.info("--> creating repository");
|
||||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder()
|
||||
.put("location", newTempDirPath())));
|
||||
.put("location", createTempDir())));
|
||||
|
||||
createIndex("test-idx", "test-idx-closed");
|
||||
ensureGreen();
|
||||
|
@ -955,7 +955,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
logger.info("--> creating repository");
|
||||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder()
|
||||
.put("location", newTempDirPath())));
|
||||
.put("location", createTempDir())));
|
||||
|
||||
createIndex("test-idx");
|
||||
ensureGreen();
|
||||
|
@ -976,7 +976,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
logger.info("--> creating repository");
|
||||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder()
|
||||
.put("location", newTempDirPath())));
|
||||
.put("location", createTempDir())));
|
||||
|
||||
createIndex("test-idx-1", "test-idx-2", "test-idx-3");
|
||||
ensureGreen();
|
||||
|
@ -1092,7 +1092,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
@Test
|
||||
public void moveShardWhileSnapshottingTest() throws Exception {
|
||||
Client client = client();
|
||||
Path repositoryLocation = newTempDirPath();
|
||||
Path repositoryLocation = createTempDir();
|
||||
logger.info("--> creating repository");
|
||||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType(MockRepositoryModule.class.getCanonicalName()).setSettings(
|
||||
|
@ -1154,7 +1154,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
@Test
|
||||
public void deleteRepositoryWhileSnapshottingTest() throws Exception {
|
||||
Client client = client();
|
||||
Path repositoryLocation = newTempDirPath();
|
||||
Path repositoryLocation = createTempDir();
|
||||
logger.info("--> creating repository");
|
||||
PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType(MockRepositoryModule.class.getCanonicalName()).setSettings(
|
||||
|
@ -1239,7 +1239,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
Client client = client();
|
||||
|
||||
logger.info("--> creating repository");
|
||||
Path repositoryLocation = newTempDirPath();
|
||||
Path repositoryLocation = createTempDir();
|
||||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder()
|
||||
.put("location", repositoryLocation)
|
||||
|
@ -1297,7 +1297,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
Client client = client();
|
||||
|
||||
logger.info("--> creating repository");
|
||||
Path repositoryLocation = newTempDirPath();
|
||||
Path repositoryLocation = createTempDir();
|
||||
boolean throttleSnapshot = randomBoolean();
|
||||
boolean throttleRestore = randomBoolean();
|
||||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
|
@ -1355,7 +1355,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
@Test
|
||||
public void snapshotStatusTest() throws Exception {
|
||||
Client client = client();
|
||||
Path repositoryLocation = newTempDirPath();
|
||||
Path repositoryLocation = createTempDir();
|
||||
logger.info("--> creating repository");
|
||||
PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType(MockRepositoryModule.class.getCanonicalName()).setSettings(
|
||||
|
@ -1458,7 +1458,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
logger.info("--> creating repository");
|
||||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder()
|
||||
.put("location", newTempDirPath())
|
||||
.put("location", createTempDir())
|
||||
.put("compress", randomBoolean())
|
||||
.put("chunk_size", randomIntBetween(100, 1000))));
|
||||
|
||||
|
@ -1506,7 +1506,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
logger.info("--> creating repository");
|
||||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder()
|
||||
.put("location", newTempDirPath())
|
||||
.put("location", createTempDir())
|
||||
.put("compress", randomBoolean())
|
||||
.put("chunk_size", randomIntBetween(100, 1000))));
|
||||
|
||||
|
@ -1569,7 +1569,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
logger.info("--> creating repository");
|
||||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder()
|
||||
.put("location", newTempDirPath())
|
||||
.put("location", createTempDir())
|
||||
.put("compress", randomBoolean())
|
||||
.put("chunk_size", randomIntBetween(100, 1000))));
|
||||
|
||||
|
@ -1675,7 +1675,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
logger.info("--> creating repository");
|
||||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType(MockRepositoryModule.class.getCanonicalName()).setSettings(ImmutableSettings.settingsBuilder()
|
||||
.put("location", newTempDirPath())
|
||||
.put("location", createTempDir())
|
||||
.put("compress", randomBoolean())
|
||||
.put("chunk_size", randomIntBetween(100, 1000))
|
||||
.put("block_on_init", true)
|
||||
|
@ -1727,7 +1727,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests {
|
|||
logger.info("--> creating repository");
|
||||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType(MockRepositoryModule.class.getCanonicalName()).setSettings(ImmutableSettings.settingsBuilder()
|
||||
.put("location", newTempDirPath())
|
||||
.put("location", createTempDir())
|
||||
.put("compress", randomBoolean())
|
||||
.put("chunk_size", randomIntBetween(100, 1000))
|
||||
));
|
||||
|
|
|
@ -59,7 +59,7 @@ public class SnapshotBackwardsCompatibilityTest extends ElasticsearchBackwardsCo
|
|||
logger.info("--> creating repository");
|
||||
assertAcked(client().admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder()
|
||||
.put("location", newTempDirPath().toAbsolutePath())
|
||||
.put("location", createTempDir().toAbsolutePath())
|
||||
.put("compress", randomBoolean())
|
||||
.put("chunk_size", randomIntBetween(100, 1000))));
|
||||
String[] indicesBefore = new String[randomIntBetween(2,5)];
|
||||
|
@ -165,7 +165,7 @@ public class SnapshotBackwardsCompatibilityTest extends ElasticsearchBackwardsCo
|
|||
|
||||
public void testSnapshotMoreThanOnce() throws ExecutionException, InterruptedException, IOException {
|
||||
Client client = client();
|
||||
final Path tempDir = newTempDirPath().toAbsolutePath();
|
||||
final Path tempDir = createTempDir().toAbsolutePath();
|
||||
logger.info("--> creating repository");
|
||||
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("fs").setSettings(ImmutableSettings.settingsBuilder()
|
||||
|
|
|
@ -22,7 +22,6 @@ import com.carrotsearch.randomizedtesting.LifecycleScope;
|
|||
import com.carrotsearch.randomizedtesting.RandomizedContext;
|
||||
import com.carrotsearch.randomizedtesting.RandomizedTest;
|
||||
import com.carrotsearch.randomizedtesting.Randomness;
|
||||
import com.carrotsearch.randomizedtesting.SysGlobals;
|
||||
import com.carrotsearch.randomizedtesting.generators.RandomInts;
|
||||
import com.carrotsearch.randomizedtesting.generators.RandomPicks;
|
||||
import com.google.common.base.Joiner;
|
||||
|
@ -281,11 +280,6 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||
* Default maximum number of shards for an index
|
||||
*/
|
||||
protected static final int DEFAULT_MAX_NUM_SHARDS = 10;
|
||||
|
||||
/**
|
||||
* The child JVM ordinal of this JVM. Default is <tt>0</tt>
|
||||
*/
|
||||
public static final int CHILD_JVM_ID = Integer.parseInt(System.getProperty(SysGlobals.CHILDVM_SYSPROP_JVM_ID, "0"));
|
||||
|
||||
/**
|
||||
* The current cluster depending on the configured {@link Scope}.
|
||||
|
@ -770,7 +764,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||
}
|
||||
// 30% of the time
|
||||
if (randomInt(9) < 3) {
|
||||
final Path dataPath = newTempDirPath();
|
||||
final Path dataPath = createTempDir();
|
||||
logger.info("using custom data_path for index: [{}]", dataPath);
|
||||
builder.put(IndexMetaData.SETTING_DATA_PATH, dataPath);
|
||||
}
|
||||
|
@ -1704,7 +1698,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||
maxNumDataNodes = getMaxNumDataNodes();
|
||||
}
|
||||
|
||||
return new InternalTestCluster(seed, newTempDirPath(), minNumDataNodes, maxNumDataNodes,
|
||||
return new InternalTestCluster(seed, createTempDir(), minNumDataNodes, maxNumDataNodes,
|
||||
clusterName(scope.name(), Integer.toString(CHILD_JVM_ID), seed), settingsSource, getNumClientNodes(),
|
||||
InternalTestCluster.DEFAULT_ENABLE_HTTP_PIPELINING, CHILD_JVM_ID, nodePrefix);
|
||||
}
|
||||
|
@ -1923,7 +1917,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||
* Return settings that could be used to start a node that has the given zipped home directory.
|
||||
*/
|
||||
protected Settings prepareBackwardsDataDir(Path backwardsIndex, Object... settings) throws IOException {
|
||||
Path indexDir = newTempDirPath();
|
||||
Path indexDir = createTempDir();
|
||||
Path dataDir = indexDir.resolve("data");
|
||||
try (InputStream stream = Files.newInputStream(backwardsIndex)) {
|
||||
TestUtil.unzip(stream, indexDir);
|
||||
|
|
|
@ -271,27 +271,6 @@ public abstract class ElasticsearchTestCase extends LuceneTestCase {
|
|||
// -----------------------------------------------------------------
|
||||
// Test facilities and facades for subclasses.
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Registers a {@link Closeable} resource that should be closed after the test
|
||||
* completes.
|
||||
*
|
||||
* @return <code>resource</code> (for call chaining).
|
||||
*/
|
||||
@Override
|
||||
public <T extends Closeable> T closeAfterTest(T resource) {
|
||||
return RandomizedContext.current().closeAtEnd(resource, LifecycleScope.TEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a {@link Closeable} resource that should be closed after the suite
|
||||
* completes.
|
||||
*
|
||||
* @return <code>resource</code> (for call chaining).
|
||||
*/
|
||||
public static <T extends Closeable> T closeAfterSuite(T resource) {
|
||||
return RandomizedContext.current().closeAtEnd(resource, LifecycleScope.SUITE);
|
||||
}
|
||||
|
||||
// old helper stuff, a lot of it is bad news and we should see if its all used
|
||||
|
||||
|
@ -900,24 +879,6 @@ public abstract class ElasticsearchTestCase extends LuceneTestCase {
|
|||
return ThreadPool.terminate(service, 10, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
// TODO: these method names stink, but are a temporary solution.
|
||||
// see https://github.com/carrotsearch/randomizedtesting/pull/178
|
||||
|
||||
/**
|
||||
* Returns a temporary file
|
||||
* @throws IOException
|
||||
*/
|
||||
public Path newTempFilePath() throws IOException {
|
||||
return createTempFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a temporary directory
|
||||
*/
|
||||
public Path newTempDirPath() {
|
||||
return createTempDir();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a random number of temporary paths.
|
||||
*/
|
||||
|
@ -925,7 +886,7 @@ public abstract class ElasticsearchTestCase extends LuceneTestCase {
|
|||
final int numPaths = TestUtil.nextInt(random(), 1, 3);
|
||||
final String[] absPaths = new String[numPaths];
|
||||
for (int i = 0; i < numPaths; i++) {
|
||||
absPaths[i] = newTempDirPath().toAbsolutePath().toString();
|
||||
absPaths[i] = createTempDir().toAbsolutePath().toString();
|
||||
}
|
||||
return absPaths;
|
||||
}
|
||||
|
@ -937,7 +898,7 @@ public abstract class ElasticsearchTestCase extends LuceneTestCase {
|
|||
public NodeEnvironment newNodeEnvironment(Settings settings) throws IOException {
|
||||
Settings build = ImmutableSettings.builder()
|
||||
.put(settings)
|
||||
.put("path.home", newTempDirPath().toAbsolutePath())
|
||||
.put("path.home", createTempDir().toAbsolutePath())
|
||||
.putArray("path.data", tmpPaths()).build();
|
||||
return new NodeEnvironment(build, new Environment(build));
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ public class FileUtilsTests extends ElasticsearchTestCase {
|
|||
assertThat(yamlSuites.get("index").size(), greaterThan(1));
|
||||
|
||||
//files can be loaded from classpath and from file system too
|
||||
Path dir = newTempDirPath();
|
||||
Path dir = createTempDir();
|
||||
Path file = dir.resolve("test_loading.yaml");
|
||||
Files.createFile(file);
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public class InternalTestClusterTests extends ElasticsearchTestCase {
|
|||
int jvmOrdinal = randomIntBetween(0, 10);
|
||||
String nodePrefix = randomRealisticUnicodeOfCodepointLengthBetween(1, 10);
|
||||
|
||||
Path baseDir = newTempDirPath();
|
||||
Path baseDir = createTempDir();
|
||||
InternalTestCluster cluster0 = new InternalTestCluster(clusterSeed, baseDir, minNumDataNodes, maxNumDataNodes, clusterName, settingsSource, numClientNodes, enableHttpPipelining, jvmOrdinal, nodePrefix);
|
||||
InternalTestCluster cluster1 = new InternalTestCluster(clusterSeed, baseDir, minNumDataNodes, maxNumDataNodes, clusterName, settingsSource, numClientNodes, enableHttpPipelining, jvmOrdinal, nodePrefix);
|
||||
assertClusters(cluster0, cluster1, true);
|
||||
|
@ -99,7 +99,7 @@ public class InternalTestClusterTests extends ElasticsearchTestCase {
|
|||
int jvmOrdinal = randomIntBetween(0, 10);
|
||||
String nodePrefix = "foobar";
|
||||
|
||||
Path baseDir = newTempDirPath();
|
||||
Path baseDir = createTempDir();
|
||||
InternalTestCluster cluster0 = new InternalTestCluster(clusterSeed, baseDir, minNumDataNodes, maxNumDataNodes, clusterName, settingsSource, numClientNodes, enableHttpPipelining, jvmOrdinal, nodePrefix);
|
||||
InternalTestCluster cluster1 = new InternalTestCluster(clusterSeed, baseDir, minNumDataNodes, maxNumDataNodes, clusterName1, settingsSource, numClientNodes, enableHttpPipelining, jvmOrdinal, nodePrefix);
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ public class FileWatcherTest extends ElasticsearchTestCase {
|
|||
|
||||
@Test
|
||||
public void testSimpleFileOperations() throws IOException {
|
||||
Path tempDir = newTempDirPath();
|
||||
Path tempDir = createTempDir();
|
||||
RecordingChangeListener changes = new RecordingChangeListener(tempDir);
|
||||
Path testFile = tempDir.resolve("test.txt");
|
||||
touch(testFile);
|
||||
|
@ -127,7 +127,7 @@ public class FileWatcherTest extends ElasticsearchTestCase {
|
|||
|
||||
@Test
|
||||
public void testSimpleDirectoryOperations() throws IOException {
|
||||
Path tempDir = newTempDirPath();
|
||||
Path tempDir = createTempDir();
|
||||
RecordingChangeListener changes = new RecordingChangeListener(tempDir);
|
||||
Path testDir = tempDir.resolve("test-dir");
|
||||
Files.createDirectories(testDir);
|
||||
|
@ -217,7 +217,7 @@ public class FileWatcherTest extends ElasticsearchTestCase {
|
|||
|
||||
@Test
|
||||
public void testNestedDirectoryOperations() throws IOException {
|
||||
Path tempDir = newTempDirPath();
|
||||
Path tempDir = createTempDir();
|
||||
RecordingChangeListener changes = new RecordingChangeListener(tempDir);
|
||||
Path testDir = tempDir.resolve("test-dir");
|
||||
Files.createDirectories(testDir);
|
||||
|
@ -283,7 +283,7 @@ public class FileWatcherTest extends ElasticsearchTestCase {
|
|||
|
||||
@Test
|
||||
public void testFileReplacingDirectory() throws IOException {
|
||||
Path tempDir = newTempDirPath();
|
||||
Path tempDir = createTempDir();
|
||||
RecordingChangeListener changes = new RecordingChangeListener(tempDir);
|
||||
Path testDir = tempDir.resolve("test-dir");
|
||||
Files.createDirectories(testDir);
|
||||
|
@ -330,7 +330,7 @@ public class FileWatcherTest extends ElasticsearchTestCase {
|
|||
|
||||
@Test
|
||||
public void testEmptyDirectory() throws IOException {
|
||||
Path tempDir = newTempDirPath();
|
||||
Path tempDir = createTempDir();
|
||||
RecordingChangeListener changes = new RecordingChangeListener(tempDir);
|
||||
Path testDir = tempDir.resolve("test-dir");
|
||||
Files.createDirectories(testDir);
|
||||
|
@ -353,7 +353,7 @@ public class FileWatcherTest extends ElasticsearchTestCase {
|
|||
|
||||
@Test
|
||||
public void testNoDirectoryOnInit() throws IOException {
|
||||
Path tempDir = newTempDirPath();
|
||||
Path tempDir = createTempDir();
|
||||
RecordingChangeListener changes = new RecordingChangeListener(tempDir);
|
||||
Path testDir = tempDir.resolve("test-dir");
|
||||
|
||||
|
@ -377,7 +377,7 @@ public class FileWatcherTest extends ElasticsearchTestCase {
|
|||
|
||||
@Test
|
||||
public void testNoFileOnInit() throws IOException {
|
||||
Path tempDir = newTempDirPath();
|
||||
Path tempDir = createTempDir();
|
||||
RecordingChangeListener changes = new RecordingChangeListener(tempDir);
|
||||
Path testFile = tempDir.resolve("testfile.txt");
|
||||
|
||||
|
|
Loading…
Reference in New Issue