You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2019/07/29 17:17:39 UTC
[maven-integration-testing] 01/01: [MNG-6720] MultiThreadedBuilder:
wait for parallel running projects when using --fail-fast
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch MNG-6720
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git
commit c711615620bd10b2c9e2c1a2d0895afed746854d
Author: Stefan Oehme <st...@gmail.com>
AuthorDate: Mon Jul 29 16:53:48 2019 +0200
[MNG-6720] MultiThreadedBuilder: wait for parallel running projects when using --fail-fast
This closes #45
---
.../org/apache/maven/it/IntegrationTestSuite.java | 1 +
.../maven/it/MavenITmng6720FailFastTest.java | 77 ++++++++++++++++++++++
.../src/test/resources/bootstrap/group-8/pom.xml | 5 ++
.../resources/mng-6720-fail-fast/module-1/pom.xml | 39 +++++++++++
.../module-1/src/test/java/Module1Test.java | 12 ++++
.../resources/mng-6720-fail-fast/module-2/pom.xml | 38 +++++++++++
.../module-2/src/test/java/Module2Test.java | 11 ++++
.../resources/mng-6720-fail-fast/module-3/pom.xml | 44 +++++++++++++
.../module-3/src/test/java/Module3Test.java | 10 +++
.../src/test/resources/mng-6720-fail-fast/pom.xml | 37 +++++++++++
10 files changed, 274 insertions(+)
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
index bb3cf81..c9986eb 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
@@ -106,6 +106,7 @@ public class IntegrationTestSuite
// -------------------------------------------------------------------------------------------------------------
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
+ suite.addTestSuite( MavenITmng6720FailFastTest.class );
suite.addTestSuite( MavenITmng6506PackageAnnotationTest.class );
suite.addTestSuite( MavenITmng6256SpecialCharsAlternatePOMLocation.class );
suite.addTestSuite( MavenITmng6386BaseUriPropertyTest.class );
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6720FailFastTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6720FailFastTest.java
new file mode 100644
index 0000000..cfcdf4c
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6720FailFastTest.java
@@ -0,0 +1,77 @@
+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() );
+
+
+ }
+}
diff --git a/core-it-suite/src/test/resources/bootstrap/group-8/pom.xml b/core-it-suite/src/test/resources/bootstrap/group-8/pom.xml
index 2d000b8..e04aaf8 100644
--- a/core-it-suite/src/test/resources/bootstrap/group-8/pom.xml
+++ b/core-it-suite/src/test/resources/bootstrap/group-8/pom.xml
@@ -94,5 +94,10 @@ under the License.
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>surefire-junit4</artifactId>
+ <version>2.12.4</version>
+ </dependency>
</dependencies>
</project>
diff --git a/core-it-suite/src/test/resources/mng-6720-fail-fast/module-1/pom.xml b/core-it-suite/src/test/resources/mng-6720-fail-fast/module-1/pom.xml
new file mode 100644
index 0000000..2025068
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6720-fail-fast/module-1/pom.xml
@@ -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>
diff --git a/core-it-suite/src/test/resources/mng-6720-fail-fast/module-1/src/test/java/Module1Test.java b/core-it-suite/src/test/resources/mng-6720-fail-fast/module-1/src/test/java/Module1Test.java
new file mode 100644
index 0000000..170c55d
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6720-fail-fast/module-1/src/test/java/Module1Test.java
@@ -0,0 +1,12 @@
+import org.junit.Test;
+
+public class Module1Test
+{
+ @Test
+ public void test() throws Exception
+ {
+ Thread.sleep( 1000L );
+ System.out.println( "Module1" );
+ throw new RuntimeException();
+ }
+}
diff --git a/core-it-suite/src/test/resources/mng-6720-fail-fast/module-2/pom.xml b/core-it-suite/src/test/resources/mng-6720-fail-fast/module-2/pom.xml
new file mode 100644
index 0000000..9141b87
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6720-fail-fast/module-2/pom.xml
@@ -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>
diff --git a/core-it-suite/src/test/resources/mng-6720-fail-fast/module-2/src/test/java/Module2Test.java b/core-it-suite/src/test/resources/mng-6720-fail-fast/module-2/src/test/java/Module2Test.java
new file mode 100644
index 0000000..8dd7b50
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6720-fail-fast/module-2/src/test/java/Module2Test.java
@@ -0,0 +1,11 @@
+import org.junit.Test;
+
+public class Module2Test
+{
+ @Test
+ public void test() throws Exception
+ {
+ Thread.sleep( 2000L );
+ System.out.println( "Module2" );
+ }
+}
diff --git a/core-it-suite/src/test/resources/mng-6720-fail-fast/module-3/pom.xml b/core-it-suite/src/test/resources/mng-6720-fail-fast/module-3/pom.xml
new file mode 100644
index 0000000..75ca15c
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6720-fail-fast/module-3/pom.xml
@@ -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>
diff --git a/core-it-suite/src/test/resources/mng-6720-fail-fast/module-3/src/test/java/Module3Test.java b/core-it-suite/src/test/resources/mng-6720-fail-fast/module-3/src/test/java/Module3Test.java
new file mode 100644
index 0000000..24f5f4a
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6720-fail-fast/module-3/src/test/java/Module3Test.java
@@ -0,0 +1,10 @@
+import org.junit.Test;
+
+public class Module3Test
+{
+ @Test
+ public void test()
+ {
+ System.out.println( "Module3" );
+ }
+}
diff --git a/core-it-suite/src/test/resources/mng-6720-fail-fast/pom.xml b/core-it-suite/src/test/resources/mng-6720-fail-fast/pom.xml
new file mode 100644
index 0000000..939fd5f
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6720-fail-fast/pom.xml
@@ -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>