Skip to content

Commit

Permalink
Explicitly set the TestKit working directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
baron1405 committed Dec 20, 2024
1 parent 419837e commit d46915e
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@


public class PluginIntegTest {
private static final Path BASE_DIR = Path.of(System.getProperty("buildDir"), "integTest");
private static final Path WORKING_DIR;

static {
try {
Files.createDirectories(BASE_DIR);
WORKING_DIR = Files.createTempDirectory(BASE_DIR, "working");
} catch (final IOException ex) {
throw new RuntimeException(ex);
}
}

private Path projectDir;

Expand All @@ -40,9 +51,7 @@ public static Stream<Arguments> gradleVersionProvider() {

@BeforeEach
public void setup() throws IOException {
final Path baseDir = Path.of(System.getProperty("buildDir"), "integTest");
Files.createDirectories(baseDir);
this.projectDir = Files.createTempDirectory(baseDir, null);
this.projectDir = Files.createTempDirectory(BASE_DIR, "project");
}

@ParameterizedTest
Expand Down Expand Up @@ -214,6 +223,7 @@ public void testVersionFileCleanOnly(final String gradleVersion) throws IOExcept
private GradleRunner createGradleRunner(final String gradleVersion, final String... arguments) {
return GradleRunner.create()
.withProjectDir(this.projectDir.toFile())
.withTestKitDir(WORKING_DIR.toFile())
.withArguments(arguments)
.withPluginClasspath()
.withEnvironment(Map.of("CTHING_CI", "true"))
Expand Down

0 comments on commit d46915e

Please sign in to comment.