-
Notifications
You must be signed in to change notification settings - Fork 70
Add integration test for --fail-fast #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6720FailFastTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| package org.apache.maven.it; | ||
|
|
||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import org.apache.maven.it.util.ResourceExtractor; | ||
|
|
||
| import java.io.File; | ||
| import java.util.Arrays; | ||
| import java.util.List; | ||
|
|
||
| /** | ||
| * An integration test to check that concurrently running projects are finished | ||
| * in --fail-fast mode, while downstream projects are skipped. | ||
| * | ||
| * <a href="https://issues.apache.org/jira/browse/MNG-6720">MNG-6720</a>. | ||
| * | ||
| */ | ||
| public class MavenITmng6720FailFastTest | ||
| extends AbstractMavenIntegrationTestCase | ||
| { | ||
|
|
||
| public MavenITmng6720FailFastTest() | ||
| { | ||
| super( "[3.6.0-SNAPSHOT,)" ); | ||
| } | ||
|
|
||
| public void testItShouldWaitForConcurrentModulesToFinish() | ||
| throws Exception | ||
| { | ||
| File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6720-fail-fast" ); | ||
|
|
||
| Verifier verifier = newVerifier( testDir.getAbsolutePath(), false ); | ||
| verifier.setMavenDebug( false ); | ||
| verifier.setAutoclean( false ); | ||
| verifier.addCliOption( "-T" ); | ||
| verifier.addCliOption( "2" ); | ||
| verifier.addCliOption( "-Dmaven.test.redirectTestOutputToFile=true" ); | ||
|
|
||
| try | ||
| { | ||
| verifier.executeGoals( Arrays.asList( "clean", "test" ) ); | ||
| } catch (VerificationException e) | ||
| { | ||
| //expected | ||
| } | ||
| verifier.resetStreams(); | ||
|
|
||
| List<String> module1Lines = verifier.loadFile(new File(testDir, "module-1/target/surefire-reports/Module1Test-output.txt"), false); | ||
| assertTrue(module1Lines.contains("Module1")); | ||
| List<String> module2Lines = verifier.loadFile(new File(testDir, "module-2/target/surefire-reports/Module2Test-output.txt"), false); | ||
| assertTrue(module2Lines.contains("Module2")); | ||
| List<String> module3Lines = verifier.loadFile(new File(testDir, "module-3/target/surefire-reports/Module3Test-output.txt"), false); | ||
| assertTrue(module3Lines.isEmpty()); | ||
|
|
||
|
michael-o marked this conversation as resolved.
|
||
|
|
||
| } | ||
| } | ||
39 changes: 39 additions & 0 deletions
39
core-it-suite/src/test/resources/mng-6720-fail-fast/module-1/pom.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
|
|
||
| <!-- | ||
| Licensed to the Apache Software Foundation (ASF) under one | ||
| or more contributor license agreements. See the NOTICE file | ||
| distributed with this work for additional information | ||
| regarding copyright ownership. The ASF licenses this file | ||
| to you under the Apache License, Version 2.0 (the | ||
| "License"); you may not use this file except in compliance | ||
| with the License. You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, | ||
| software distributed under the License is distributed on an | ||
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations | ||
| under the License. | ||
| --> | ||
|
|
||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <groupId>mng-6720-fail-fast</groupId> | ||
| <artifactId>module-1</artifactId> | ||
| <version>1.0</version> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>junit</groupId> | ||
| <artifactId>junit</artifactId> | ||
| <version>4.12</version> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| </project> |
10 changes: 10 additions & 0 deletions
10
core-it-suite/src/test/resources/mng-6720-fail-fast/module-1/src/test/java/Module1Test.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import org.junit.Test; | ||
|
|
||
| public class Module1Test { | ||
| @Test | ||
| public void test() throws Exception { | ||
| Thread.sleep(1000); | ||
| System.out.println("Module1"); | ||
| throw new RuntimeException(); | ||
| } | ||
|
michael-o marked this conversation as resolved.
|
||
| } | ||
38 changes: 38 additions & 0 deletions
38
core-it-suite/src/test/resources/mng-6720-fail-fast/module-2/pom.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
|
|
||
| <!-- | ||
| Licensed to the Apache Software Foundation (ASF) under one | ||
| or more contributor license agreements. See the NOTICE file | ||
| distributed with this work for additional information | ||
| regarding copyright ownership. The ASF licenses this file | ||
| to you under the Apache License, Version 2.0 (the | ||
| "License"); you may not use this file except in compliance | ||
| with the License. You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, | ||
| software distributed under the License is distributed on an | ||
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations | ||
| under the License. | ||
| --> | ||
|
|
||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <groupId>mng-6720-fail-fast</groupId> | ||
| <artifactId>module-2</artifactId> | ||
| <version>1.0</version> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>junit</groupId> | ||
| <artifactId>junit</artifactId> | ||
| <version>4.12</version> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| </dependencies> | ||
| </project> |
9 changes: 9 additions & 0 deletions
9
core-it-suite/src/test/resources/mng-6720-fail-fast/module-2/src/test/java/Module2Test.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import org.junit.Test; | ||
|
|
||
| public class Module2Test { | ||
| @Test | ||
| public void test() throws Exception { | ||
| Thread.sleep(2000); | ||
| System.out.println("Module2"); | ||
| } | ||
| } | ||
|
michael-o marked this conversation as resolved.
|
||
44 changes: 44 additions & 0 deletions
44
core-it-suite/src/test/resources/mng-6720-fail-fast/module-3/pom.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
|
|
||
| <!-- | ||
| Licensed to the Apache Software Foundation (ASF) under one | ||
| or more contributor license agreements. See the NOTICE file | ||
| distributed with this work for additional information | ||
| regarding copyright ownership. The ASF licenses this file | ||
| to you under the Apache License, Version 2.0 (the | ||
| "License"); you may not use this file except in compliance | ||
| with the License. You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, | ||
| software distributed under the License is distributed on an | ||
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations | ||
| under the License. | ||
| --> | ||
|
|
||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <groupId>mng-6720-fail-fast</groupId> | ||
| <artifactId>module-3</artifactId> | ||
| <version>1.0</version> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>junit</groupId> | ||
| <artifactId>junit</artifactId> | ||
| <version>4.12</version> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>mng-6720-fail-fast</groupId> | ||
| <artifactId>module2</artifactId> | ||
| <version>${project.version}</version> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| </project> |
8 changes: 8 additions & 0 deletions
8
core-it-suite/src/test/resources/mng-6720-fail-fast/module-3/src/test/java/Module3Test.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import org.junit.Test; | ||
|
|
||
| public class Module3Test { | ||
| @Test | ||
| public void test() { | ||
| System.out.println("Module3"); | ||
| } | ||
| } | ||
|
michael-o marked this conversation as resolved.
|
||
37 changes: 37 additions & 0 deletions
37
core-it-suite/src/test/resources/mng-6720-fail-fast/pom.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
|
|
||
| <!-- | ||
| Licensed to the Apache Software Foundation (ASF) under one | ||
| or more contributor license agreements. See the NOTICE file | ||
| distributed with this work for additional information | ||
| regarding copyright ownership. The ASF licenses this file | ||
| to you under the Apache License, Version 2.0 (the | ||
| "License"); you may not use this file except in compliance | ||
| with the License. You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, | ||
| software distributed under the License is distributed on an | ||
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations | ||
| under the License. | ||
| --> | ||
|
|
||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <groupId>mng-6720-fail-fast</groupId> | ||
| <artifactId>parent</artifactId> | ||
| <version>1.0</version> | ||
|
|
||
| <packaging>pom</packaging> | ||
|
|
||
| <modules> | ||
| <module>module-1</module> | ||
| <module>module-2</module> | ||
| <module>module-3</module> | ||
| </modules> | ||
| </project> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.