From dae0ed168a8de0e3af6673a2e30e6eb443eacdb2 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Thu, 19 Feb 2015 13:47:44 -0800 Subject: [PATCH] Test: Remove use of globalTempDir() and forbid it from future use. Using this temp dir circumvents test isolation and isn't necessary. closes #9777 --- dev-tools/forbidden/test-signatures.txt | 2 ++ .../org/elasticsearch/common/io/FileSystemUtilsTests.java | 2 +- .../java/org/elasticsearch/test/ElasticsearchTestCase.java | 7 ------- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/dev-tools/forbidden/test-signatures.txt b/dev-tools/forbidden/test-signatures.txt index e69de29bb2d..a4d5737281e 100644 --- a/dev-tools/forbidden/test-signatures.txt +++ b/dev-tools/forbidden/test-signatures.txt @@ -0,0 +1,2 @@ + +com.carrotsearch.randomizedtesting.RandomizedTest#globalTempDir() @ Use newTempDirPath() instead diff --git a/src/test/java/org/elasticsearch/common/io/FileSystemUtilsTests.java b/src/test/java/org/elasticsearch/common/io/FileSystemUtilsTests.java index 3519bfc449b..8226360d60b 100644 --- a/src/test/java/org/elasticsearch/common/io/FileSystemUtilsTests.java +++ b/src/test/java/org/elasticsearch/common/io/FileSystemUtilsTests.java @@ -92,7 +92,7 @@ public class FileSystemUtilsTests extends ElasticsearchTestCase { @Test public void testMoveOverExistingFileAndIgnore() throws IOException { - Path dest = globalTempDirPath(); + Path dest = newTempDirPath(); FileSystemUtils.moveFilesWithoutOverwriting(src.resolve("v1"), dest, null); assertFileContent(dest, "file1.txt", "version1"); diff --git a/src/test/java/org/elasticsearch/test/ElasticsearchTestCase.java b/src/test/java/org/elasticsearch/test/ElasticsearchTestCase.java index 41fe805dbe1..9fe2f877b0b 100644 --- a/src/test/java/org/elasticsearch/test/ElasticsearchTestCase.java +++ b/src/test/java/org/elasticsearch/test/ElasticsearchTestCase.java @@ -557,13 +557,6 @@ public abstract class ElasticsearchTestCase extends AbstractRandomizedTest { public static Path newTempDirPath(LifecycleScope scope) { return newTempDir(scope).toPath(); } - - /** - * Returns 'global' temp dir (seems like a bad idea) - */ - public static Path globalTempDirPath() { - return globalTempDir().toPath(); - } /** * Returns a random number of temporary paths.