Skip to content

Commit 88931d5

Browse files
authored
Proper isolation of maven-executor UTs (#11392) (#11393)
They lacked in some cases the `.mvn` directory, and it caused Maven to "bubble up" all way to Maven Project own `.mvn`. Now the UT properly confine the test within CWD by creating `.mvn` in it. Backport of 23d38a2
1 parent 87fa189 commit 88931d5

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

impl/maven-executor/src/test/java/org/apache/maven/cling/executor/MavenExecutorTestSupport.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public abstract class MavenExecutorTestSupport {
5656
@BeforeEach
5757
void beforeEach(TestInfo testInfo) throws Exception {
5858
cwd = tempDir.resolve(testInfo.getTestMethod().orElseThrow().getName()).resolve("cwd");
59-
Files.createDirectories(cwd);
59+
Files.createDirectories(cwd.resolve(".mvn"));
6060
userHome = tempDir.resolve(testInfo.getTestMethod().orElseThrow().getName())
6161
.resolve("home");
6262
Files.createDirectories(userHome);
@@ -380,7 +380,6 @@ private ExecutorRequest.Builder customize(ExecutorRequest.Builder builder) {
380380
}
381381

382382
protected void layDownFiles(Path cwd) throws IOException {
383-
Files.createDirectory(cwd.resolve(".mvn"));
384383
Path pom = cwd.resolve("pom.xml").toAbsolutePath();
385384
Files.writeString(pom, POM_STRING);
386385
Path appJava = cwd.resolve("src/main/java/org/apache/maven/samples/sample/App.java");

impl/maven-executor/src/test/java/org/apache/maven/cling/executor/impl/ToolboxToolTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void beforeEach(TestInfo testInfo) throws Exception {
6060
String testName = testInfo.getTestMethod().orElseThrow().getName();
6161
userHome = tempDir.resolve(testName);
6262
cwd = userHome.resolve("cwd");
63-
Files.createDirectories(cwd);
63+
Files.createDirectories(cwd.resolve(".mvn"));
6464

6565
if (MimirInfuser.isMimirPresentUW()) {
6666
if (testName.contains("3")) {

0 commit comments

Comments
 (0)