Skip to content

Commit

Permalink
Merge pull request #42585 from gsmet/fix-test-temp-directory
Browse files Browse the repository at this point in the history
Do not try to create temp directory in test archives
  • Loading branch information
gsmet committed Aug 16, 2024
2 parents 9196d18 + ff11475 commit 9070ad7
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,15 @@ protected PrepareResult createAugmentor(ExtensionContext context, Class<? extend
}

// Creates a temporary application.properties file for the test with a high ordinal (build and runtime)
Path tempDirectory = Files.createTempDirectory(testClassLocation, requiredTestClass.getSimpleName());
// Note that in the case of the Quarkus Platform, the testClassLocation is actually a jar so we can't
// create a temp directory in it.
Path tempDirectory;
if (Files.isDirectory(testClassLocation) && Files.isWritable(testClassLocation)) {
tempDirectory = Files.createTempDirectory(testClassLocation, requiredTestClass.getSimpleName());
} else {
tempDirectory = Files.createTempDirectory(requiredTestClass.getSimpleName());
}

Path propertiesFile = tempDirectory.resolve("application.properties");
Files.createFile(propertiesFile);
Properties properties = new Properties();
Expand Down

0 comments on commit 9070ad7

Please sign in to comment.