Skip to content

Commit 9070ad7

Browse files
authored
Merge pull request #42585 from gsmet/fix-test-temp-directory
Do not try to create temp directory in test archives
2 parents 9196d18 + ff11475 commit 9070ad7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test-framework/junit5/src/main/java/io/quarkus/test/junit/AbstractJvmQuarkusTestExtension.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,15 @@ protected PrepareResult createAugmentor(ExtensionContext context, Class<? extend
176176
}
177177

178178
// Creates a temporary application.properties file for the test with a high ordinal (build and runtime)
179-
Path tempDirectory = Files.createTempDirectory(testClassLocation, requiredTestClass.getSimpleName());
179+
// Note that in the case of the Quarkus Platform, the testClassLocation is actually a jar so we can't
180+
// create a temp directory in it.
181+
Path tempDirectory;
182+
if (Files.isDirectory(testClassLocation) && Files.isWritable(testClassLocation)) {
183+
tempDirectory = Files.createTempDirectory(testClassLocation, requiredTestClass.getSimpleName());
184+
} else {
185+
tempDirectory = Files.createTempDirectory(requiredTestClass.getSimpleName());
186+
}
187+
180188
Path propertiesFile = tempDirectory.resolve("application.properties");
181189
Files.createFile(propertiesFile);
182190
Properties properties = new Properties();

0 commit comments

Comments
 (0)