Skip to content

Commit

Permalink
Do not try to create temp directory in test archives
Browse files Browse the repository at this point in the history
When dealing with test archives, such as in the Platform, we shouldn't
try to create a temp directory in the archive.

Related to the failure described here:
quarkusio/quarkus-platform#1255 (comment)
  • Loading branch information
gsmet committed Aug 16, 2024
1 parent 698f5bf commit ff11475
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 ff11475

Please sign in to comment.