This is an automated email from the ASF dual-hosted git repository.
xianjin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-uniffle.git
The following commit(s) were added to refs/heads/master by this push:
new 6307ecb9 [Test] Cleanup tests with Files#createTempDir() (#492)
6307ecb9 is described below
commit 6307ecb909e37bee3a78a46f8bce0236d1326fb9
Author: Kaijie Chen <[email protected]>
AuthorDate: Tue Jan 17 16:48:19 2023 +0800
[Test] Cleanup tests with Files#createTempDir() (#492)
### What changes were proposed in this pull request?
Replace `Files#createTempDir()` with `@TempDir`.
Cleanup some tests.
### Why are the changes needed?
`Files#createTempDir()` is deprecated, it's better to use `@TempDir` from
JUnit 5.
This PR should closes #418
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Existing CI.
---
.../task/reduce/RssInMemoryRemoteMergerTest.java | 6 +--
.../task/reduce/RssRemoteMergeManagerTest.java | 6 +--
.../uniffle/test/AssignmentWithTagsTest.java | 18 ++++----
.../uniffle/test/CoordinatorAssignmentTest.java | 5 +-
.../uniffle/test/DiskErrorToleranceTest.java | 5 +-
.../test/HealthCheckCoordinatorGrpcTest.java | 5 +-
.../uniffle/test/MultiStorageHdfsFallbackTest.java | 6 ++-
...java => MultiStorageLocalFileFallbackTest.java} | 8 ++--
.../java/org/apache/uniffle/test/QuorumTest.java | 54 +++++++++-------------
.../apache/uniffle/test/ShuffleReadWriteBase.java | 8 +---
.../test/ShuffleServerFaultToleranceTest.java | 22 +++------
.../apache/uniffle/test/ShuffleServerGrpcTest.java | 5 +-
.../ShuffleServerWithLocalOfExceptionTest.java | 5 +-
.../ShuffleServerWithLocalOfLocalOrderTest.java | 5 +-
.../uniffle/test/ShuffleServerWithLocalTest.java | 5 +-
.../test/ShuffleServerWithMemLocalHdfsTest.java | 6 +--
.../uniffle/test/ShuffleServerWithMemoryTest.java | 5 +-
.../uniffle/test/ShuffleWithRssClientTest.java | 6 +--
.../RepartitionWithHdfsMultiStorageRssTest.java | 6 +--
.../test/RepartitionWithLocalFileRssTest.java | 5 +-
.../RepartitionWithMemoryMultiStorageRssTest.java | 6 +--
.../uniffle/test/RepartitionWithMemoryRssTest.java | 6 +--
.../uniffle/test/SparkClientWithLocalTest.java | 5 +-
.../test/SparkSQLWithDelegationShuffleManager.java | 6 +--
...arkSQLWithDelegationShuffleManagerFallback.java | 6 +--
.../uniffle/test/SparkSQLWithMemoryLocalTest.java | 6 +--
.../storage/handler/impl/LocalFileHandlerTest.java | 10 ++--
27 files changed, 93 insertions(+), 143 deletions(-)
diff --git
a/client-mr/src/test/java/org/apache/hadoop/mapreduce/task/reduce/RssInMemoryRemoteMergerTest.java
b/client-mr/src/test/java/org/apache/hadoop/mapreduce/task/reduce/RssInMemoryRemoteMergerTest.java
index 51e535fb..5361c5f6 100644
---
a/client-mr/src/test/java/org/apache/hadoop/mapreduce/task/reduce/RssInMemoryRemoteMergerTest.java
+++
b/client-mr/src/test/java/org/apache/hadoop/mapreduce/task/reduce/RssInMemoryRemoteMergerTest.java
@@ -26,7 +26,6 @@ import java.util.Map;
import java.util.TreeMap;
import com.google.common.collect.Lists;
-import com.google.common.io.Files;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FSDataOutputStream;
@@ -47,6 +46,7 @@ import org.apache.hadoop.mapreduce.TaskID;
import org.apache.hadoop.mapreduce.TaskType;
import org.apache.hadoop.util.Progress;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -54,12 +54,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
public class RssInMemoryRemoteMergerTest {
@Test
- public void mergerTest() throws IOException {
+ public void mergerTest(@TempDir File tmpDir) throws IOException {
JobConf jobConf = new JobConf();
FileSystem fs = FileSystem.getLocal(jobConf);
LocalDirAllocator lda = new LocalDirAllocator(MRConfig.LOCAL_DIR);
- File tmpDir = Files.createTempDir();
- tmpDir.deleteOnExit();
JobID jobId = new JobID("a", 0);
final TaskAttemptID mapId1 = new TaskAttemptID(
new TaskID(jobId, TaskType.MAP, 1), 0);
diff --git
a/client-mr/src/test/java/org/apache/hadoop/mapreduce/task/reduce/RssRemoteMergeManagerTest.java
b/client-mr/src/test/java/org/apache/hadoop/mapreduce/task/reduce/RssRemoteMergeManagerTest.java
index c8baab60..892ca171 100644
---
a/client-mr/src/test/java/org/apache/hadoop/mapreduce/task/reduce/RssRemoteMergeManagerTest.java
+++
b/client-mr/src/test/java/org/apache/hadoop/mapreduce/task/reduce/RssRemoteMergeManagerTest.java
@@ -25,7 +25,6 @@ import java.util.Map;
import java.util.TreeMap;
import com.google.common.collect.Lists;
-import com.google.common.io.Files;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FSDataOutputStream;
@@ -47,6 +46,7 @@ import org.apache.hadoop.mapreduce.TaskID;
import org.apache.hadoop.mapreduce.TaskType;
import org.apache.hadoop.util.Progress;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -62,13 +62,11 @@ public class RssRemoteMergeManagerTest {
new TaskID(jobId, TaskType.REDUCE, 0), 0);
@Test
- public void mergerTest() throws Throwable {
+ public void mergerTest(@TempDir File tmpDir) throws Throwable {
JobConf jobConf = new JobConf();
final FileSystem fs = FileSystem.getLocal(jobConf);
final LocalDirAllocator lda = new LocalDirAllocator(MRConfig.LOCAL_DIR);
- File tmpDir = Files.createTempDir();
- tmpDir.deleteOnExit();
jobConf.set("mapreduce.reduce.memory.totalbytes", "1024");
jobConf.set("mapreduce.reduce.shuffle.memory.limit.percent", "0.01");
jobConf.set("mapreduce.reduce.shuffle.merge.percent", "0.1");
diff --git
a/integration-test/common/src/test/java/org/apache/uniffle/test/AssignmentWithTagsTest.java
b/integration-test/common/src/test/java/org/apache/uniffle/test/AssignmentWithTagsTest.java
index bf28994f..589d992b 100644
---
a/integration-test/common/src/test/java/org/apache/uniffle/test/AssignmentWithTagsTest.java
+++
b/integration-test/common/src/test/java/org/apache/uniffle/test/AssignmentWithTagsTest.java
@@ -28,10 +28,10 @@ import java.util.Set;
import java.util.stream.Collectors;
import com.google.common.collect.Sets;
-import com.google.common.io.Files;
import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -77,13 +77,10 @@ public class AssignmentWithTagsTest extends
CoordinatorTestBase {
return ports;
}
- private static void createAndStartShuffleServerWithTags(Set<String> tags)
throws Exception {
+ private static void createAndStartShuffleServerWithTags(Set<String> tags,
File tmpDir) throws Exception {
ShuffleServerConf shuffleServerConf = getShuffleServerConf();
shuffleServerConf.setLong("rss.server.app.expired.withoutHeartbeat", 4000);
- File tmpDir = Files.createTempDir();
- tmpDir.deleteOnExit();
-
File dataDir1 = new File(tmpDir, "data1");
File dataDir2 = new File(tmpDir, "data2");
String basePath = dataDir1.getAbsolutePath() + "," +
dataDir2.getAbsolutePath();
@@ -112,7 +109,7 @@ public class AssignmentWithTagsTest extends
CoordinatorTestBase {
}
@BeforeAll
- public static void setupServers() throws Exception {
+ public static void setupServers(@TempDir File tmpDir) throws Exception {
CoordinatorConf coordinatorConf = getCoordinatorConf();
createCoordinatorServer(coordinatorConf);
@@ -120,16 +117,19 @@ public class AssignmentWithTagsTest extends
CoordinatorTestBase {
coordinator.start();
}
+ File dir1 = new File(tmpDir, "server1");
for (int i = 0; i < 2; i++) {
- createAndStartShuffleServerWithTags(Sets.newHashSet());
+ createAndStartShuffleServerWithTags(Sets.newHashSet(), dir1);
}
+ File dir2 = new File(tmpDir, "server2");
for (int i = 0; i < 2; i++) {
- createAndStartShuffleServerWithTags(Sets.newHashSet("fixed"));
+ createAndStartShuffleServerWithTags(Sets.newHashSet("fixed"), dir2);
}
+ File dir3 = new File(tmpDir, "server3");
for (int i = 0; i < 2; i++) {
- createAndStartShuffleServerWithTags(Sets.newHashSet("elastic"));
+ createAndStartShuffleServerWithTags(Sets.newHashSet("elastic"), dir3);
}
// Wait all shuffle servers registering to coordinator
diff --git
a/integration-test/common/src/test/java/org/apache/uniffle/test/CoordinatorAssignmentTest.java
b/integration-test/common/src/test/java/org/apache/uniffle/test/CoordinatorAssignmentTest.java
index a767a543..e73d8738 100644
---
a/integration-test/common/src/test/java/org/apache/uniffle/test/CoordinatorAssignmentTest.java
+++
b/integration-test/common/src/test/java/org/apache/uniffle/test/CoordinatorAssignmentTest.java
@@ -23,9 +23,9 @@ import java.util.Arrays;
import java.util.HashSet;
import com.google.common.collect.Sets;
-import com.google.common.io.Files;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -50,7 +50,7 @@ public class CoordinatorAssignmentTest extends
CoordinatorTestBase {
LOCALHOST + ":" + COORDINATOR_PORT_1 + "," + LOCALHOST + ":" +
COORDINATOR_PORT_2;
@BeforeAll
- public static void setupServers() throws Exception {
+ public static void setupServers(@TempDir File tmpDir) throws Exception {
CoordinatorConf coordinatorConf1 = getCoordinatorConf();
coordinatorConf1.setLong(CoordinatorConf.COORDINATOR_APP_EXPIRED, 2000);
coordinatorConf1.setInteger(CoordinatorConf.COORDINATOR_SHUFFLE_NODES_MAX,
SHUFFLE_NODES_MAX);
@@ -65,7 +65,6 @@ public class CoordinatorAssignmentTest extends
CoordinatorTestBase {
for (int i = 0; i < SERVER_NUM; i++) {
ShuffleServerConf shuffleServerConf = getShuffleServerConf();
- File tmpDir = Files.createTempDir();
File dataDir1 = new File(tmpDir, "data1");
String basePath = dataDir1.getAbsolutePath();
shuffleServerConf.set(ShuffleServerConf.RSS_STORAGE_TYPE,
StorageType.MEMORY_LOCALFILE_HDFS.name());
diff --git
a/integration-test/common/src/test/java/org/apache/uniffle/test/DiskErrorToleranceTest.java
b/integration-test/common/src/test/java/org/apache/uniffle/test/DiskErrorToleranceTest.java
index 0704850f..f7916533 100644
---
a/integration-test/common/src/test/java/org/apache/uniffle/test/DiskErrorToleranceTest.java
+++
b/integration-test/common/src/test/java/org/apache/uniffle/test/DiskErrorToleranceTest.java
@@ -27,13 +27,13 @@ import java.util.concurrent.TimeUnit;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
-import com.google.common.io.Files;
import com.google.common.util.concurrent.Uninterruptibles;
import org.apache.commons.io.FileUtils;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.roaringbitmap.longlong.Roaring64NavigableMap;
import org.apache.uniffle.client.impl.ShuffleReadClientImpl;
@@ -56,7 +56,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
public class DiskErrorToleranceTest extends ShuffleReadWriteBase {
private ShuffleServerGrpcClient shuffleServerClient;
- private static File serverTmpDir = Files.createTempDir();
+ @TempDir private static File serverTmpDir;
private static File data1 = new File(serverTmpDir, "data1");
private static File data2 = new File(serverTmpDir, "data2");
private List<ShuffleServerInfo> shuffleServerInfo =
@@ -64,7 +64,6 @@ public class DiskErrorToleranceTest extends
ShuffleReadWriteBase {
@BeforeAll
public static void setupServers() throws Exception {
- serverTmpDir.deleteOnExit();
CoordinatorConf coordinatorConf = getCoordinatorConf();
createCoordinatorServer(coordinatorConf);
ShuffleServerConf shuffleServerConf = getShuffleServerConf();
diff --git
a/integration-test/common/src/test/java/org/apache/uniffle/test/HealthCheckCoordinatorGrpcTest.java
b/integration-test/common/src/test/java/org/apache/uniffle/test/HealthCheckCoordinatorGrpcTest.java
index 608e0371..a0c9f670 100644
---
a/integration-test/common/src/test/java/org/apache/uniffle/test/HealthCheckCoordinatorGrpcTest.java
+++
b/integration-test/common/src/test/java/org/apache/uniffle/test/HealthCheckCoordinatorGrpcTest.java
@@ -25,10 +25,10 @@ import java.util.Random;
import java.util.concurrent.TimeUnit;
import com.google.common.collect.Sets;
-import com.google.common.io.Files;
import com.google.common.util.concurrent.Uninterruptibles;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.apache.uniffle.client.request.RssGetShuffleAssignmentsRequest;
import org.apache.uniffle.client.response.ResponseStatusCode;
@@ -46,13 +46,12 @@ import static org.junit.jupiter.api.Assertions.fail;
public class HealthCheckCoordinatorGrpcTest extends CoordinatorTestBase {
- private static File serverTmpDir = Files.createTempDir();
+ @TempDir private static File serverTmpDir;
private static File tempDataFile = new File(serverTmpDir, "data");
private static int writeDataSize;
@BeforeAll
public static void setupServers() throws Exception {
- serverTmpDir.deleteOnExit();
File data1 = new File(serverTmpDir, "data1");
data1.mkdirs();
File data2 = new File(serverTmpDir, "data2");
diff --git
a/integration-test/common/src/test/java/org/apache/uniffle/test/MultiStorageHdfsFallbackTest.java
b/integration-test/common/src/test/java/org/apache/uniffle/test/MultiStorageHdfsFallbackTest.java
index 63ec7ac7..2a6cc1a2 100644
---
a/integration-test/common/src/test/java/org/apache/uniffle/test/MultiStorageHdfsFallbackTest.java
+++
b/integration-test/common/src/test/java/org/apache/uniffle/test/MultiStorageHdfsFallbackTest.java
@@ -17,9 +17,11 @@
package org.apache.uniffle.test;
+import java.io.File;
import java.util.Arrays;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.io.TempDir;
import org.apache.uniffle.coordinator.CoordinatorConf;
import org.apache.uniffle.server.ShuffleServerConf;
@@ -30,10 +32,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
public class MultiStorageHdfsFallbackTest extends
MultiStorageFaultToleranceBase {
@BeforeAll
- public static void setupServers() throws Exception {
+ public static void setupServers(@TempDir File tmpDir) throws Exception {
final CoordinatorConf coordinatorConf = getCoordinatorConf();
ShuffleServerConf shuffleServerConf = getShuffleServerConf();
- String basePath = generateBasePath();
+ String basePath = generateBasePath(tmpDir);
shuffleServerConf.setDouble(ShuffleServerConf.CLEANUP_THRESHOLD, 0.0);
shuffleServerConf.setDouble(ShuffleServerConf.HIGH_WATER_MARK_OF_WRITE,
100.0);
shuffleServerConf.setLong(ShuffleServerConf.DISK_CAPACITY, 1024L * 1024L *
100);
diff --git
a/integration-test/common/src/test/java/org/apache/uniffle/test/MultiStorageLocalfileFallbackTest.java
b/integration-test/common/src/test/java/org/apache/uniffle/test/MultiStorageLocalFileFallbackTest.java
similarity index 92%
rename from
integration-test/common/src/test/java/org/apache/uniffle/test/MultiStorageLocalfileFallbackTest.java
rename to
integration-test/common/src/test/java/org/apache/uniffle/test/MultiStorageLocalFileFallbackTest.java
index 7d70d017..c3d92934 100644
---
a/integration-test/common/src/test/java/org/apache/uniffle/test/MultiStorageLocalfileFallbackTest.java
+++
b/integration-test/common/src/test/java/org/apache/uniffle/test/MultiStorageLocalFileFallbackTest.java
@@ -17,9 +17,11 @@
package org.apache.uniffle.test;
+import java.io.File;
import java.util.Arrays;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.io.TempDir;
import org.apache.uniffle.coordinator.CoordinatorConf;
import org.apache.uniffle.server.ShuffleServerConf;
@@ -30,13 +32,13 @@ import org.apache.uniffle.storage.common.LocalStorage;
import org.apache.uniffle.storage.common.Storage;
import org.apache.uniffle.storage.util.StorageType;
-public class MultiStorageLocalfileFallbackTest extends
MultiStorageFaultToleranceBase {
+public class MultiStorageLocalFileFallbackTest extends
MultiStorageFaultToleranceBase {
@BeforeAll
- public static void setupServers() throws Exception {
+ public static void setupServers(@TempDir File tmpDir) throws Exception {
final CoordinatorConf coordinatorConf = getCoordinatorConf();
ShuffleServerConf shuffleServerConf = getShuffleServerConf();
- String basePath = generateBasePath();
+ String basePath = generateBasePath(tmpDir);
shuffleServerConf.setDouble(ShuffleServerConf.CLEANUP_THRESHOLD, 0.0);
shuffleServerConf.setDouble(ShuffleServerConf.HIGH_WATER_MARK_OF_WRITE,
100.0);
shuffleServerConf.setLong(ShuffleServerConf.DISK_CAPACITY, 1024L * 1024L *
100);
diff --git
a/integration-test/common/src/test/java/org/apache/uniffle/test/QuorumTest.java
b/integration-test/common/src/test/java/org/apache/uniffle/test/QuorumTest.java
index d46b0885..14309fc1 100644
---
a/integration-test/common/src/test/java/org/apache/uniffle/test/QuorumTest.java
+++
b/integration-test/common/src/test/java/org/apache/uniffle/test/QuorumTest.java
@@ -24,11 +24,10 @@ import java.util.Map;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
-import com.google.common.io.Files;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.roaringbitmap.longlong.Roaring64NavigableMap;
import org.apache.uniffle.client.factory.ShuffleServerClientFactory;
@@ -72,12 +71,10 @@ public class QuorumTest extends ShuffleReadWriteBase {
private static ShuffleServerInfo fakedShuffleServerInfo4;
private MockedShuffleWriteClientImpl shuffleWriteClientImpl;
- public static MockedShuffleServer createServer(int id) throws Exception {
+ public static MockedShuffleServer createServer(int id, File tmpDir) throws
Exception {
ShuffleServerConf shuffleServerConf = getShuffleServerConf();
shuffleServerConf.setLong("rss.server.app.expired.withoutHeartbeat", 8000);
shuffleServerConf.setLong("rss.server.heartbeat.interval", 5000);
- File tmpDir = Files.createTempDir();
- tmpDir.deleteOnExit();
File dataDir1 = new File(tmpDir, id + "_1");
File dataDir2 = new File(tmpDir, id + "_2");
String basePath = dataDir1.getAbsolutePath() + "," +
dataDir2.getAbsolutePath();
@@ -88,21 +85,19 @@ public class QuorumTest extends ShuffleReadWriteBase {
return new MockedShuffleServer(shuffleServerConf);
}
- @BeforeAll
- public static void initCluster() throws Exception {
+ @BeforeEach
+ public void initCluster(@TempDir File tmpDir) throws Exception {
CoordinatorConf coordinatorConf = getCoordinatorConf();
createCoordinatorServer(coordinatorConf);
ShuffleServerConf shuffleServerConf = getShuffleServerConf();
shuffleServerConf.setLong("rss.server.app.expired.withoutHeartbeat", 8000);
- File tmpDir = Files.createTempDir();
- tmpDir.deleteOnExit();
- shuffleServers.add(createServer(0));
- shuffleServers.add(createServer(1));
- shuffleServers.add(createServer(2));
- shuffleServers.add(createServer(3));
- shuffleServers.add(createServer(4));
+ shuffleServers.add(createServer(0, tmpDir));
+ shuffleServers.add(createServer(1, tmpDir));
+ shuffleServers.add(createServer(2, tmpDir));
+ shuffleServers.add(createServer(3, tmpDir));
+ shuffleServers.add(createServer(4, tmpDir));
shuffleServerInfo0 =
new ShuffleServerInfo("127.0.0.1-20001",
shuffleServers.get(0).getIp(), SHUFFLE_SERVER_PORT + 0);
@@ -132,6 +127,17 @@ public class QuorumTest extends ShuffleReadWriteBase {
new ShuffleServerInfo("127.0.0.1-20004",
shuffleServers.get(2).getIp(), SHUFFLE_SERVER_PORT + 400);
fakedShuffleServerInfo4 =
new ShuffleServerInfo("127.0.0.1-20005",
shuffleServers.get(2).getIp(), SHUFFLE_SERVER_PORT + 500);
+
+ // spark.rss.data.replica=3
+ // spark.rss.data.replica.write=2
+ // spark.rss.data.replica.read=2
+ ((ShuffleServerGrpcClient)ShuffleServerClientFactory
+ .getInstance().getShuffleServerClient("GRPC",
shuffleServerInfo0)).adjustTimeout(200);
+ ((ShuffleServerGrpcClient)ShuffleServerClientFactory
+ .getInstance().getShuffleServerClient("GRPC",
shuffleServerInfo1)).adjustTimeout(200);
+ ((ShuffleServerGrpcClient)ShuffleServerClientFactory
+ .getInstance().getShuffleServerClient("GRPC",
shuffleServerInfo2)).adjustTimeout(200);
+
Thread.sleep(2000);
}
@@ -146,26 +152,12 @@ public class QuorumTest extends ShuffleReadWriteBase {
coordinators = Lists.newArrayList();
}
- @BeforeEach
- public void initEnv() throws Exception {
- // spark.rss.data.replica=3
- // spark.rss.data.replica.write=2
- // spark.rss.data.replica.read=2
- ((ShuffleServerGrpcClient)ShuffleServerClientFactory
- .getInstance().getShuffleServerClient("GRPC",
shuffleServerInfo0)).adjustTimeout(200);
- ((ShuffleServerGrpcClient)ShuffleServerClientFactory
- .getInstance().getShuffleServerClient("GRPC",
shuffleServerInfo1)).adjustTimeout(200);
- ((ShuffleServerGrpcClient)ShuffleServerClientFactory
- .getInstance().getShuffleServerClient("GRPC",
shuffleServerInfo2)).adjustTimeout(200);
- }
-
@AfterEach
public void cleanEnv() throws Exception {
if (shuffleWriteClientImpl != null) {
shuffleWriteClientImpl.close();
}
cleanCluster();
- initCluster();
// we need recovery `rpcTime`, or some unit tests may fail
((ShuffleServerGrpcClient)ShuffleServerClientFactory
.getInstance().getShuffleServerClient("GRPC",
shuffleServerInfo0)).adjustTimeout(60000);
@@ -471,7 +463,7 @@ public class QuorumTest extends ShuffleReadWriteBase {
}
@Test
- public void case5() throws Exception {
+ public void case5(@TempDir File tmpDir) throws Exception {
// this case is to simulate server restarting.
String testAppId = "case5";
registerShuffleServer(testAppId, 3, 2, 2, true);
@@ -505,7 +497,7 @@ public class QuorumTest extends ShuffleReadWriteBase {
// when one server is restarted, getShuffleResult should success
shuffleServers.get(1).stopServer();
- shuffleServers.set(1, createServer(1));
+ shuffleServers.set(1, createServer(1, tmpDir));
shuffleServers.get(1).start();
report = shuffleWriteClientImpl.getShuffleResult("GRPC",
Sets.newHashSet(shuffleServerInfo0, shuffleServerInfo1,
shuffleServerInfo2),
@@ -514,7 +506,7 @@ public class QuorumTest extends ShuffleReadWriteBase {
// when two servers are restarted, getShuffleResult should fail
shuffleServers.get(2).stopServer();
- shuffleServers.set(2, createServer(2));
+ shuffleServers.set(2, createServer(2, tmpDir));
shuffleServers.get(2).start();
try {
report = shuffleWriteClientImpl.getShuffleResult("GRPC",
diff --git
a/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleReadWriteBase.java
b/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleReadWriteBase.java
index ca0afadc..02372b05 100644
---
a/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleReadWriteBase.java
+++
b/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleReadWriteBase.java
@@ -26,7 +26,6 @@ import java.util.concurrent.atomic.AtomicLong;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-import com.google.common.io.Files;
import org.roaringbitmap.longlong.Roaring64NavigableMap;
import org.apache.uniffle.client.TestUtils;
@@ -111,13 +110,10 @@ public abstract class ShuffleReadWriteBase extends
IntegrationTestBase {
TestUtils.validateResult(readClient, expectedData);
}
- public static String generateBasePath() {
- File tmpDir = Files.createTempDir();
+ public static String generateBasePath(File tmpDir) {
File dataDir1 = new File(tmpDir, "data1");
File dataDir2 = new File(tmpDir, "data2");
- tmpDir.deleteOnExit();
- String basePath = dataDir1.getAbsolutePath() + "," +
dataDir2.getAbsolutePath();
- return basePath;
+ return dataDir1.getAbsolutePath() + "," + dataDir2.getAbsolutePath();
}
public static List<ShuffleDataSegment> readShuffleIndexSegments(
diff --git
a/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerFaultToleranceTest.java
b/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerFaultToleranceTest.java
index 82f44089..5b12e9ac 100644
---
a/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerFaultToleranceTest.java
+++
b/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerFaultToleranceTest.java
@@ -24,11 +24,10 @@ import java.util.Map;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-import com.google.common.io.Files;
import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.roaringbitmap.longlong.Roaring64NavigableMap;
import org.apache.uniffle.client.TestUtils;
@@ -66,18 +65,14 @@ public class ShuffleServerFaultToleranceTest extends
ShuffleReadWriteBase {
private String remoteStoragePath = HDFS_URI + "rss/test";
- @BeforeAll
- public static void setupServers() throws Exception {
+ @BeforeEach
+ public void setupServers(@TempDir File tmpDir) throws Exception {
CoordinatorConf coordinatorConf = getCoordinatorConf();
createCoordinatorServer(coordinatorConf);
- shuffleServers.add(createServer(0));
- shuffleServers.add(createServer(1));
- shuffleServers.add(createServer(2));
+ shuffleServers.add(createServer(0, tmpDir));
+ shuffleServers.add(createServer(1, tmpDir));
+ shuffleServers.add(createServer(2, tmpDir));
startServers();
- }
-
- @BeforeEach
- public void createClient() {
shuffleServerClients = new ArrayList<>();
for (ShuffleServer shuffleServer : shuffleServers) {
shuffleServerClients.add(new
ShuffleServerGrpcClient(shuffleServer.getIp(), shuffleServer.getPort()));
@@ -90,7 +85,6 @@ public class ShuffleServerFaultToleranceTest extends
ShuffleReadWriteBase {
client.close();
});
cleanCluster();
- setupServers();
}
@Test
@@ -235,7 +229,7 @@ public class ShuffleServerFaultToleranceTest extends
ShuffleReadWriteBase {
});
}
- public static MockedShuffleServer createServer(int id) throws Exception {
+ public static MockedShuffleServer createServer(int id, File tmpDir) throws
Exception {
ShuffleServerConf shuffleServerConf = getShuffleServerConf();
shuffleServerConf.set(ShuffleServerConf.RSS_STORAGE_TYPE,
StorageType.LOCALFILE.name());
shuffleServerConf.set(ShuffleServerConf.SERVER_APP_EXPIRED_WITHOUT_HEARTBEAT,
5000L);
@@ -245,8 +239,6 @@ public class ShuffleServerFaultToleranceTest extends
ShuffleReadWriteBase {
shuffleServerConf.set(ShuffleServerConf.SERVER_APP_EXPIRED_WITHOUT_HEARTBEAT,
5000L);
shuffleServerConf.set(ShuffleServerConf.DISK_CAPACITY, 1000000L);
shuffleServerConf.setLong("rss.server.heartbeat.interval", 5000);
- File tmpDir = Files.createTempDir();
- tmpDir.deleteOnExit();
File dataDir1 = new File(tmpDir, id + "_1");
File dataDir2 = new File(tmpDir, id + "_2");
String basePath = dataDir1.getAbsolutePath() + "," +
dataDir2.getAbsolutePath();
diff --git
a/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerGrpcTest.java
b/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerGrpcTest.java
index 438dba20..fde353b6 100644
---
a/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerGrpcTest.java
+++
b/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerGrpcTest.java
@@ -27,12 +27,12 @@ import java.util.concurrent.atomic.AtomicInteger;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
-import com.google.common.io.Files;
import com.google.protobuf.ByteString;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.roaringbitmap.longlong.Roaring64NavigableMap;
import org.apache.uniffle.client.api.ShuffleWriteClient;
@@ -80,12 +80,11 @@ public class ShuffleServerGrpcTest extends
IntegrationTestBase {
private static final int GB = 1024 * 1024 * 1024;
@BeforeAll
- public static void setupServers() throws Exception {
+ public static void setupServers(@TempDir File tmpDir) throws Exception {
CoordinatorConf coordinatorConf = getCoordinatorConf();
coordinatorConf.setLong(CoordinatorConf.COORDINATOR_APP_EXPIRED, 2000);
createCoordinatorServer(coordinatorConf);
ShuffleServerConf shuffleServerConf = getShuffleServerConf();
- File tmpDir = Files.createTempDir();
File dataDir1 = new File(tmpDir, "data1");
String basePath = dataDir1.getAbsolutePath();
shuffleServerConf.set(ShuffleServerConf.RSS_STORAGE_TYPE,
StorageType.MEMORY_LOCALFILE_HDFS.name());
diff --git
a/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerWithLocalOfExceptionTest.java
b/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerWithLocalOfExceptionTest.java
index 4e8aa0d6..741f498b 100644
---
a/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerWithLocalOfExceptionTest.java
+++
b/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerWithLocalOfExceptionTest.java
@@ -19,11 +19,11 @@ package org.apache.uniffle.test;
import java.io.File;
-import com.google.common.io.Files;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.roaringbitmap.longlong.Roaring64NavigableMap;
import org.apache.uniffle.client.impl.grpc.ShuffleServerGrpcClient;
@@ -42,12 +42,11 @@ public class ShuffleServerWithLocalOfExceptionTest extends
ShuffleReadWriteBase
private static String REMOTE_STORAGE = HDFS_URI + "rss/test";
@BeforeAll
- public static void setupServers() throws Exception {
+ public static void setupServers(@TempDir File tmpDir) throws Exception {
CoordinatorConf coordinatorConf = getCoordinatorConf();
createCoordinatorServer(coordinatorConf);
ShuffleServerConf shuffleServerConf = getShuffleServerConf();
- File tmpDir = Files.createTempDir();
File dataDir1 = new File(tmpDir, "data1");
File dataDir2 = new File(tmpDir, "data2");
String basePath = dataDir1.getAbsolutePath() + "," +
dataDir2.getAbsolutePath();
diff --git
a/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerWithLocalOfLocalOrderTest.java
b/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerWithLocalOfLocalOrderTest.java
index 06a37b2a..ad9cba47 100644
---
a/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerWithLocalOfLocalOrderTest.java
+++
b/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerWithLocalOfLocalOrderTest.java
@@ -28,12 +28,12 @@ import java.util.stream.Collectors;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-import com.google.common.io.Files;
import org.apache.commons.lang3.tuple.Pair;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.roaringbitmap.longlong.Roaring64NavigableMap;
import org.apache.uniffle.client.impl.grpc.ShuffleServerGrpcClient;
@@ -66,11 +66,10 @@ public class ShuffleServerWithLocalOfLocalOrderTest extends
ShuffleReadWriteBase
private ShuffleServerGrpcClient shuffleServerClient;
@BeforeAll
- public static void setupServers() throws Exception {
+ public static void setupServers(@TempDir File tmpDir) throws Exception {
CoordinatorConf coordinatorConf = getCoordinatorConf();
createCoordinatorServer(coordinatorConf);
ShuffleServerConf shuffleServerConf = getShuffleServerConf();
- File tmpDir = Files.createTempDir();
File dataDir1 = new File(tmpDir, "data1");
File dataDir2 = new File(tmpDir, "data2");
String basePath = dataDir1.getAbsolutePath() + "," +
dataDir2.getAbsolutePath();
diff --git
a/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerWithLocalTest.java
b/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerWithLocalTest.java
index 2bb31b36..67b76d66 100644
---
a/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerWithLocalTest.java
+++
b/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerWithLocalTest.java
@@ -26,11 +26,11 @@ import java.util.Set;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
-import com.google.common.io.Files;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.roaringbitmap.longlong.LongIterator;
import org.roaringbitmap.longlong.Roaring64NavigableMap;
@@ -58,11 +58,10 @@ public class ShuffleServerWithLocalTest extends
ShuffleReadWriteBase {
private ShuffleServerGrpcClient shuffleServerClient;
@BeforeAll
- private static void setupServers() throws Exception {
+ public static void setupServers(@TempDir File tmpDir) throws Exception {
CoordinatorConf coordinatorConf = getCoordinatorConf();
createCoordinatorServer(coordinatorConf);
ShuffleServerConf shuffleServerConf = getShuffleServerConf();
- File tmpDir = Files.createTempDir();
File dataDir1 = new File(tmpDir, "data1");
File dataDir2 = new File(tmpDir, "data2");
String basePath = dataDir1.getAbsolutePath() + "," +
dataDir2.getAbsolutePath();
diff --git
a/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerWithMemLocalHdfsTest.java
b/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerWithMemLocalHdfsTest.java
index 947612d4..c27fe6f9 100644
---
a/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerWithMemLocalHdfsTest.java
+++
b/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerWithMemLocalHdfsTest.java
@@ -24,11 +24,11 @@ import java.util.Map;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-import com.google.common.io.Files;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.roaringbitmap.longlong.Roaring64NavigableMap;
import org.apache.uniffle.client.impl.grpc.ShuffleServerGrpcClient;
@@ -60,12 +60,10 @@ public class ShuffleServerWithMemLocalHdfsTest extends
ShuffleReadWriteBase {
private static String REMOTE_STORAGE = HDFS_URI + "rss/test";
@BeforeAll
- public static void setupServers() throws Exception {
+ public static void setupServers(@TempDir File tmpDir) throws Exception {
CoordinatorConf coordinatorConf = getCoordinatorConf();
createCoordinatorServer(coordinatorConf);
ShuffleServerConf shuffleServerConf = getShuffleServerConf();
- File tmpDir = Files.createTempDir();
- tmpDir.deleteOnExit();
File dataDir = new File(tmpDir, "data");
String basePath = dataDir.getAbsolutePath();
shuffleServerConf.set(ShuffleServerConf.RSS_STORAGE_BASE_PATH,
Arrays.asList(basePath));
diff --git
a/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerWithMemoryTest.java
b/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerWithMemoryTest.java
index 1ffc8540..b2f32d8c 100644
---
a/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerWithMemoryTest.java
+++
b/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleServerWithMemoryTest.java
@@ -24,11 +24,11 @@ import java.util.Map;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-import com.google.common.io.Files;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.roaringbitmap.longlong.Roaring64NavigableMap;
import org.apache.uniffle.client.impl.grpc.ShuffleServerGrpcClient;
@@ -58,11 +58,10 @@ public class ShuffleServerWithMemoryTest extends
ShuffleReadWriteBase {
private ShuffleServerGrpcClient shuffleServerClient;
@BeforeAll
- public static void setupServers() throws Exception {
+ public static void setupServers(@TempDir File tmpDir) throws Exception {
CoordinatorConf coordinatorConf = getCoordinatorConf();
createCoordinatorServer(coordinatorConf);
ShuffleServerConf shuffleServerConf = getShuffleServerConf();
- File tmpDir = Files.createTempDir();
File dataDir = new File(tmpDir, "data");
String basePath = dataDir.getAbsolutePath();
shuffleServerConf.set(ShuffleServerConf.RSS_STORAGE_TYPE,
StorageType.LOCALFILE.name());
diff --git
a/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleWithRssClientTest.java
b/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleWithRssClientTest.java
index a4e505ec..0a7e1227 100644
---
a/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleWithRssClientTest.java
+++
b/integration-test/common/src/test/java/org/apache/uniffle/test/ShuffleWithRssClientTest.java
@@ -25,11 +25,11 @@ import java.util.concurrent.atomic.AtomicInteger;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
-import com.google.common.io.Files;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.roaringbitmap.longlong.Roaring64NavigableMap;
import org.apache.uniffle.client.impl.ShuffleReadClientImpl;
@@ -64,13 +64,11 @@ public class ShuffleWithRssClientTest extends
ShuffleReadWriteBase {
private ShuffleWriteClientImpl shuffleWriteClientImpl;
@BeforeAll
- public static void setupServers() throws Exception {
+ public static void setupServers(@TempDir File tmpDir) throws Exception {
CoordinatorConf coordinatorConf = getCoordinatorConf();
createCoordinatorServer(coordinatorConf);
ShuffleServerConf shuffleServerConf = getShuffleServerConf();
shuffleServerConf.setLong("rss.server.app.expired.withoutHeartbeat", 4000);
- File tmpDir = Files.createTempDir();
- tmpDir.deleteOnExit();
File dataDir1 = new File(tmpDir, "data1");
File dataDir2 = new File(tmpDir, "data2");
String basePath = dataDir1.getAbsolutePath() + "," +
dataDir2.getAbsolutePath();
diff --git
a/integration-test/spark-common/src/test/java/org/apache/uniffle/test/RepartitionWithHdfsMultiStorageRssTest.java
b/integration-test/spark-common/src/test/java/org/apache/uniffle/test/RepartitionWithHdfsMultiStorageRssTest.java
index 4d71ea52..43b4a7c0 100644
---
a/integration-test/spark-common/src/test/java/org/apache/uniffle/test/RepartitionWithHdfsMultiStorageRssTest.java
+++
b/integration-test/spark-common/src/test/java/org/apache/uniffle/test/RepartitionWithHdfsMultiStorageRssTest.java
@@ -22,10 +22,10 @@ import java.util.Arrays;
import java.util.Map;
import com.google.common.collect.Maps;
-import com.google.common.io.Files;
import org.apache.spark.SparkConf;
import org.apache.spark.shuffle.RssSparkConfig;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.io.TempDir;
import org.apache.uniffle.coordinator.CoordinatorConf;
import org.apache.uniffle.server.ShuffleServerConf;
@@ -33,7 +33,7 @@ import org.apache.uniffle.storage.util.StorageType;
public class RepartitionWithHdfsMultiStorageRssTest extends RepartitionTest {
@BeforeAll
- public static void setupServers() throws Exception {
+ public static void setupServers(@TempDir File tmpDir) throws Exception {
CoordinatorConf coordinatorConf = getCoordinatorConf();
Map<String, String> dynamicConf = Maps.newHashMap();
dynamicConf.put(CoordinatorConf.COORDINATOR_REMOTE_STORAGE_PATH.key(),
HDFS_URI + "rss/test");
@@ -43,8 +43,6 @@ public class RepartitionWithHdfsMultiStorageRssTest extends
RepartitionTest {
ShuffleServerConf shuffleServerConf = getShuffleServerConf();
// local storage config
- File tmpDir = Files.createTempDir();
- tmpDir.deleteOnExit();
File dataDir1 = new File(tmpDir, "data1");
File dataDir2 = new File(tmpDir, "data2");
String basePath = dataDir1.getAbsolutePath() + "," +
dataDir2.getAbsolutePath();
diff --git
a/integration-test/spark-common/src/test/java/org/apache/uniffle/test/RepartitionWithLocalFileRssTest.java
b/integration-test/spark-common/src/test/java/org/apache/uniffle/test/RepartitionWithLocalFileRssTest.java
index 7a0fe5f4..0f845994 100644
---
a/integration-test/spark-common/src/test/java/org/apache/uniffle/test/RepartitionWithLocalFileRssTest.java
+++
b/integration-test/spark-common/src/test/java/org/apache/uniffle/test/RepartitionWithLocalFileRssTest.java
@@ -24,11 +24,11 @@ import java.util.Map;
import java.util.concurrent.TimeUnit;
import com.google.common.collect.Maps;
-import com.google.common.io.Files;
import com.google.common.util.concurrent.Uninterruptibles;
import org.apache.spark.SparkConf;
import org.apache.spark.shuffle.RssSparkConfig;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.io.TempDir;
import org.apache.uniffle.common.compression.Codec;
import org.apache.uniffle.coordinator.CoordinatorConf;
@@ -40,14 +40,13 @@ import static
org.apache.uniffle.common.config.RssClientConf.COMPRESSION_TYPE;
public class RepartitionWithLocalFileRssTest extends RepartitionTest {
@BeforeAll
- public static void setupServers() throws Exception {
+ public static void setupServers(@TempDir File tmpDir) throws Exception {
CoordinatorConf coordinatorConf = getCoordinatorConf();
Map<String, String> dynamicConf = Maps.newHashMap();
dynamicConf.put(RssSparkConfig.RSS_STORAGE_TYPE.key(),
StorageType.LOCALFILE.name());
addDynamicConf(coordinatorConf, dynamicConf);
createCoordinatorServer(coordinatorConf);
ShuffleServerConf shuffleServerConf = getShuffleServerConf();
- File tmpDir = Files.createTempDir();
File dataDir1 = new File(tmpDir, "data1");
File dataDir2 = new File(tmpDir, "data2");
String basePath = dataDir1.getAbsolutePath() + "," +
dataDir2.getAbsolutePath();
diff --git
a/integration-test/spark-common/src/test/java/org/apache/uniffle/test/RepartitionWithMemoryMultiStorageRssTest.java
b/integration-test/spark-common/src/test/java/org/apache/uniffle/test/RepartitionWithMemoryMultiStorageRssTest.java
index 232a31b8..e8e567d1 100644
---
a/integration-test/spark-common/src/test/java/org/apache/uniffle/test/RepartitionWithMemoryMultiStorageRssTest.java
+++
b/integration-test/spark-common/src/test/java/org/apache/uniffle/test/RepartitionWithMemoryMultiStorageRssTest.java
@@ -22,10 +22,10 @@ import java.util.Arrays;
import java.util.Map;
import com.google.common.collect.Maps;
-import com.google.common.io.Files;
import org.apache.spark.SparkConf;
import org.apache.spark.shuffle.RssSparkConfig;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.io.TempDir;
import org.apache.uniffle.coordinator.CoordinatorConf;
import org.apache.uniffle.server.ShuffleServerConf;
@@ -33,7 +33,7 @@ import org.apache.uniffle.storage.util.StorageType;
public class RepartitionWithMemoryMultiStorageRssTest extends RepartitionTest {
@BeforeAll
- public static void setupServers() throws Exception {
+ public static void setupServers(@TempDir File tmpDir) throws Exception {
CoordinatorConf coordinatorConf = getCoordinatorConf();
Map<String, String> dynamicConf = Maps.newHashMap();
dynamicConf.put(CoordinatorConf.COORDINATOR_REMOTE_STORAGE_PATH.key(),
HDFS_URI + "rss/test");
@@ -43,8 +43,6 @@ public class RepartitionWithMemoryMultiStorageRssTest extends
RepartitionTest {
ShuffleServerConf shuffleServerConf = getShuffleServerConf();
// local storage config
- File tmpDir = Files.createTempDir();
- tmpDir.deleteOnExit();
File dataDir1 = new File(tmpDir, "data1");
File dataDir2 = new File(tmpDir, "data2");
String basePath = dataDir1.getAbsolutePath() + "," +
dataDir2.getAbsolutePath();
diff --git
a/integration-test/spark-common/src/test/java/org/apache/uniffle/test/RepartitionWithMemoryRssTest.java
b/integration-test/spark-common/src/test/java/org/apache/uniffle/test/RepartitionWithMemoryRssTest.java
index 63a641ea..fd917a60 100644
---
a/integration-test/spark-common/src/test/java/org/apache/uniffle/test/RepartitionWithMemoryRssTest.java
+++
b/integration-test/spark-common/src/test/java/org/apache/uniffle/test/RepartitionWithMemoryRssTest.java
@@ -22,11 +22,11 @@ import java.util.Arrays;
import java.util.Map;
import com.google.common.collect.Maps;
-import com.google.common.io.Files;
import org.apache.spark.SparkConf;
import org.apache.spark.shuffle.RssSparkConfig;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.apache.uniffle.coordinator.CoordinatorConf;
import org.apache.uniffle.server.ShuffleServerConf;
@@ -35,7 +35,7 @@ import org.apache.uniffle.storage.util.StorageType;
public class RepartitionWithMemoryRssTest extends RepartitionTest {
@BeforeAll
- public static void setupServers() throws Exception {
+ public static void setupServers(@TempDir File tmpDir) throws Exception {
CoordinatorConf coordinatorConf = getCoordinatorConf();
coordinatorConf.set(CoordinatorConf.COORDINATOR_APP_EXPIRED, 5000L);
Map<String, String> dynamicConf = Maps.newHashMap();
@@ -45,8 +45,6 @@ public class RepartitionWithMemoryRssTest extends
RepartitionTest {
ShuffleServerConf shuffleServerConf = getShuffleServerConf();
shuffleServerConf.set(ShuffleServerConf.SERVER_HEARTBEAT_INTERVAL, 5000L);
shuffleServerConf.set(ShuffleServerConf.SERVER_APP_EXPIRED_WITHOUT_HEARTBEAT,
4000L);
- File tmpDir = Files.createTempDir();
- tmpDir.deleteOnExit();
File dataDir1 = new File(tmpDir, "data1");
File dataDir2 = new File(tmpDir, "data2");
String basePath = dataDir1.getAbsolutePath() + "," +
dataDir2.getAbsolutePath();
diff --git
a/integration-test/spark-common/src/test/java/org/apache/uniffle/test/SparkClientWithLocalTest.java
b/integration-test/spark-common/src/test/java/org/apache/uniffle/test/SparkClientWithLocalTest.java
index 34e14e1c..8b530557 100644
---
a/integration-test/spark-common/src/test/java/org/apache/uniffle/test/SparkClientWithLocalTest.java
+++
b/integration-test/spark-common/src/test/java/org/apache/uniffle/test/SparkClientWithLocalTest.java
@@ -23,12 +23,12 @@ import java.util.Map;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-import com.google.common.io.Files;
import org.apache.commons.io.FileUtils;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.roaringbitmap.longlong.LongIterator;
import org.roaringbitmap.longlong.Roaring64NavigableMap;
@@ -62,11 +62,10 @@ public class SparkClientWithLocalTest extends
ShuffleReadWriteBase {
Lists.newArrayList(new ShuffleServerInfo(LOCALHOST,
SHUFFLE_SERVER_PORT));
@BeforeAll
- public static void setupServers() throws Exception {
+ public static void setupServers(@TempDir File tmpDir) throws Exception {
CoordinatorConf coordinatorConf = getCoordinatorConf();
createCoordinatorServer(coordinatorConf);
ShuffleServerConf shuffleServerConf = getShuffleServerConf();
- File tmpDir = Files.createTempDir();
DATA_DIR1 = new File(tmpDir, "data1");
DATA_DIR2 = new File(tmpDir, "data2");
String basePath = DATA_DIR1.getAbsolutePath() + "," +
DATA_DIR2.getAbsolutePath();
diff --git
a/integration-test/spark-common/src/test/java/org/apache/uniffle/test/SparkSQLWithDelegationShuffleManager.java
b/integration-test/spark-common/src/test/java/org/apache/uniffle/test/SparkSQLWithDelegationShuffleManager.java
index 48ef0cb5..21c04a88 100644
---
a/integration-test/spark-common/src/test/java/org/apache/uniffle/test/SparkSQLWithDelegationShuffleManager.java
+++
b/integration-test/spark-common/src/test/java/org/apache/uniffle/test/SparkSQLWithDelegationShuffleManager.java
@@ -24,11 +24,11 @@ import java.util.Objects;
import java.util.concurrent.TimeUnit;
import com.google.common.collect.Maps;
-import com.google.common.io.Files;
import com.google.common.util.concurrent.Uninterruptibles;
import org.apache.spark.SparkConf;
import org.apache.spark.shuffle.RssSparkConfig;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.io.TempDir;
import org.apache.uniffle.coordinator.CoordinatorConf;
import org.apache.uniffle.server.ShuffleServerConf;
@@ -37,7 +37,7 @@ import org.apache.uniffle.storage.util.StorageType;
public class SparkSQLWithDelegationShuffleManager extends SparkSQLTest {
@BeforeAll
- public static void setupServers() throws Exception {
+ public static void setupServers(@TempDir File tmpDir) throws Exception {
final String candidates = Objects.requireNonNull(
SparkSQLWithDelegationShuffleManager.class.getClassLoader().getResource("candidates")).getFile();
CoordinatorConf coordinatorConf = getCoordinatorConf();
@@ -55,8 +55,6 @@ public class SparkSQLWithDelegationShuffleManager extends
SparkSQLTest {
ShuffleServerConf shuffleServerConf = getShuffleServerConf();
shuffleServerConf.set(ShuffleServerConf.SERVER_HEARTBEAT_INTERVAL, 1000L);
shuffleServerConf.set(ShuffleServerConf.SERVER_APP_EXPIRED_WITHOUT_HEARTBEAT,
4000L);
- File tmpDir = Files.createTempDir();
- tmpDir.deleteOnExit();
File dataDir1 = new File(tmpDir, "data1");
File dataDir2 = new File(tmpDir, "data2");
String basePath = dataDir1.getAbsolutePath() + "," +
dataDir2.getAbsolutePath();
diff --git
a/integration-test/spark-common/src/test/java/org/apache/uniffle/test/SparkSQLWithDelegationShuffleManagerFallback.java
b/integration-test/spark-common/src/test/java/org/apache/uniffle/test/SparkSQLWithDelegationShuffleManagerFallback.java
index f4edba13..da67498a 100644
---
a/integration-test/spark-common/src/test/java/org/apache/uniffle/test/SparkSQLWithDelegationShuffleManagerFallback.java
+++
b/integration-test/spark-common/src/test/java/org/apache/uniffle/test/SparkSQLWithDelegationShuffleManagerFallback.java
@@ -24,11 +24,11 @@ import java.util.Objects;
import java.util.concurrent.TimeUnit;
import com.google.common.collect.Maps;
-import com.google.common.io.Files;
import com.google.common.util.concurrent.Uninterruptibles;
import org.apache.spark.SparkConf;
import org.apache.spark.shuffle.RssSparkConfig;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.io.TempDir;
import org.apache.uniffle.coordinator.CoordinatorConf;
import org.apache.uniffle.server.ShuffleServerConf;
@@ -37,7 +37,7 @@ import org.apache.uniffle.storage.util.StorageType;
public class SparkSQLWithDelegationShuffleManagerFallback extends SparkSQLTest
{
@BeforeAll
- public static void setupServers() throws Exception {
+ public static void setupServers(@TempDir File tmpDir) throws Exception {
final String candidates = Objects.requireNonNull(
SparkSQLWithDelegationShuffleManager.class.getClassLoader().getResource("candidates")).getFile();
CoordinatorConf coordinatorConf = getCoordinatorConf();
@@ -55,8 +55,6 @@ public class SparkSQLWithDelegationShuffleManagerFallback
extends SparkSQLTest {
ShuffleServerConf shuffleServerConf = getShuffleServerConf();
shuffleServerConf.set(ShuffleServerConf.SERVER_HEARTBEAT_INTERVAL, 1000L);
shuffleServerConf.set(ShuffleServerConf.SERVER_APP_EXPIRED_WITHOUT_HEARTBEAT,
4000L);
- File tmpDir = Files.createTempDir();
- tmpDir.deleteOnExit();
File dataDir1 = new File(tmpDir, "data1");
File dataDir2 = new File(tmpDir, "data2");
String basePath = dataDir1.getAbsolutePath() + "," +
dataDir2.getAbsolutePath();
diff --git
a/integration-test/spark-common/src/test/java/org/apache/uniffle/test/SparkSQLWithMemoryLocalTest.java
b/integration-test/spark-common/src/test/java/org/apache/uniffle/test/SparkSQLWithMemoryLocalTest.java
index 98432720..e92285a2 100644
---
a/integration-test/spark-common/src/test/java/org/apache/uniffle/test/SparkSQLWithMemoryLocalTest.java
+++
b/integration-test/spark-common/src/test/java/org/apache/uniffle/test/SparkSQLWithMemoryLocalTest.java
@@ -21,10 +21,10 @@ import java.io.File;
import java.util.Map;
import com.google.common.collect.Maps;
-import com.google.common.io.Files;
import org.apache.spark.SparkConf;
import org.apache.spark.shuffle.RssSparkConfig;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.io.TempDir;
import org.apache.uniffle.coordinator.CoordinatorConf;
import org.apache.uniffle.server.ShuffleServerConf;
@@ -37,7 +37,7 @@ public class SparkSQLWithMemoryLocalTest extends SparkSQLTest
{
private static String basePath;
@BeforeAll
- public static void setupServers() throws Exception {
+ public static void setupServers(@TempDir File tmpDir) throws Exception {
CoordinatorConf coordinatorConf = getCoordinatorConf();
coordinatorConf.setLong("rss.coordinator.app.expired", 5000);
Map<String, String> dynamicConf = Maps.newHashMap();
@@ -47,8 +47,6 @@ public class SparkSQLWithMemoryLocalTest extends SparkSQLTest
{
ShuffleServerConf shuffleServerConf = getShuffleServerConf();
shuffleServerConf.setLong("rss.server.heartbeat.interval", 5000);
shuffleServerConf.setLong("rss.server.app.expired.withoutHeartbeat", 4000);
- File tmpDir = Files.createTempDir();
- tmpDir.deleteOnExit();
File dataDir1 = new File(tmpDir, "data1");
File dataDir2 = new File(tmpDir, "data2");
basePath = dataDir1.getAbsolutePath() + "," + dataDir2.getAbsolutePath();
diff --git
a/storage/src/test/java/org/apache/uniffle/storage/handler/impl/LocalFileHandlerTest.java
b/storage/src/test/java/org/apache/uniffle/storage/handler/impl/LocalFileHandlerTest.java
index a5c99674..5e984777 100644
---
a/storage/src/test/java/org/apache/uniffle/storage/handler/impl/LocalFileHandlerTest.java
+++
b/storage/src/test/java/org/apache/uniffle/storage/handler/impl/LocalFileHandlerTest.java
@@ -25,8 +25,8 @@ import java.util.Set;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
-import com.google.common.io.Files;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.apache.uniffle.common.ShuffleDataResult;
import org.apache.uniffle.common.ShuffleIndexResult;
@@ -40,9 +40,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
public class LocalFileHandlerTest {
@Test
- public void writeTest() throws Exception {
- File tmpDir = Files.createTempDir();
- tmpDir.deleteOnExit();
+ public void writeTest(@TempDir File tmpDir) throws Exception {
File dataDir1 = new File(tmpDir, "data1");
File dataDir2 = new File(tmpDir, "data2");
String[] basePaths = new String[]{dataDir1.getAbsolutePath(),
@@ -112,9 +110,7 @@ public class LocalFileHandlerTest {
}
@Test
- public void writeBigDataTest() throws IOException {
- File tmpDir = Files.createTempDir();
- tmpDir.deleteOnExit();
+ public void writeBigDataTest(@TempDir File tmpDir) throws IOException {
File writeFile = new File(tmpDir, "writetest");
LocalFileWriter writer = new LocalFileWriter(writeFile);
int size = Integer.MAX_VALUE / 100;