Skip to content

Commit f65e89c

Browse files
committed
Allow for parallel runs of TempLocationManagerTest
1 parent df36231 commit f65e89c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

dd-java-agent/agent-profiling/profiling-controller/src/test/java/com/datadog/profiling/controller/TempLocationManagerTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import java.nio.file.Paths;
1111
import java.nio.file.attribute.PosixFilePermissions;
1212
import java.util.Properties;
13+
import java.util.UUID;
14+
1315
import org.junit.jupiter.api.Test;
1416

1517
public class TempLocationManagerTest {
@@ -28,7 +30,7 @@ void testDefault() throws Exception {
2830

2931
@Test
3032
void testFromConfig() throws Exception {
31-
Path myDir = Paths.get(System.getProperty("java.io.tmpdir"), "test1");
33+
Path myDir = Paths.get(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString());
3234
Files.createDirectories(myDir);
3335
Properties props = new Properties();
3436
props.put(ProfilingConfig.PROFILING_TEMP_DIR, myDir.toString());
@@ -41,7 +43,7 @@ void testFromConfig() throws Exception {
4143

4244
@Test
4345
void testFromConfigInvalid() {
44-
Path myDir = Paths.get(System.getProperty("java.io.tmpdir"), "test2");
46+
Path myDir = Paths.get(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString());
4547
// do not create the directory - it should trigger an exception
4648
Properties props = new Properties();
4749
props.put(ProfilingConfig.PROFILING_TEMP_DIR, myDir.toString());
@@ -51,7 +53,7 @@ void testFromConfigInvalid() {
5153

5254
@Test
5355
void testFromConfigNotWritable() throws Exception {
54-
Path myDir = Paths.get(System.getProperty("java.io.tmpdir"), "test3");
56+
Path myDir = Paths.get(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString());
5557
Files.createDirectories(
5658
myDir, PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("r-x------")));
5759
Properties props = new Properties();
@@ -63,7 +65,7 @@ void testFromConfigNotWritable() throws Exception {
6365

6466
@Test
6567
void testCleanup() throws Exception {
66-
Path myDir = Paths.get(System.getProperty("java.io.tmpdir"), "test4");
68+
Path myDir = Paths.get(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString());
6769
Files.createDirectories(myDir);
6870
Properties props = new Properties();
6971
props.put(ProfilingConfig.PROFILING_TEMP_DIR, myDir.toString());

0 commit comments

Comments
 (0)