You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2021/02/12 19:39:25 UTC

[GitHub] [maven-integration-testing] MartinKanters commented on a change in pull request #98: [MNG-7095] Support for parallel builds when resuming

MartinKanters commented on a change in pull request #98:
URL: https://github.com/apache/maven-integration-testing/pull/98#discussion_r575473333



##########
File path: core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5760ResumeFeatureTest.java
##########
@@ -175,6 +179,112 @@ public void testShouldNotCrashWithoutProject() throws Exception
         }
     }
 
+    public void testFailureWithParallelBuild() throws Exception
+    {
+        Verifier verifier = newVerifier( fourModulesTestDir.getAbsolutePath() );
+        verifier.addCliOption( "-T2" );
+        verifier.addCliOption( "-Dmodule-a.delay=1000" );
+        verifier.addCliOption( "-Dmodule-a.fail=true" );
+        verifier.addCliOption( "-Dmodule-c.fail=true" );
+
+        verifier.executeGoal( "org.apache.maven.plugins:maven-clean-plugin:clean" );
+        verifier.deleteArtifact( "org.apache.maven.its.mng5760", "module-a", "1.0", "jar" );
+        verifier.deleteArtifact( "org.apache.maven.its.mng5760", "module-b", "1.0", "jar" );
+        verifier.deleteArtifact( "org.apache.maven.its.mng5760", "module-c", "1.0", "jar" );
+        verifier.deleteArtifact( "org.apache.maven.its.mng5760", "module-d", "1.0", "jar" );
+
+        try
+        {
+            verifier.executeGoal( "install" );
+            fail( "Expected this invocation to fail" );
+        }
+        catch ( final VerificationException ve )
+        {
+            // Expected to fail.
+            verifier.assertArtifactNotPresent( "org.apache.maven.its.mng5760", "module-a", "1.0", "jar" );
+            verifier.assertArtifactPresent( "org.apache.maven.its.mng5760", "module-b", "1.0", "jar" );
+            verifier.assertArtifactNotPresent( "org.apache.maven.its.mng5760", "module-c", "1.0", "jar" );
+            verifier.assertArtifactNotPresent( "org.apache.maven.its.mng5760", "module-d", "1.0", "jar" );
+        }
+        finally
+        {
+            verifier.resetStreams();
+        }
+
+        // Let module-b and module-c fail, if they would have been built...

Review comment:
       You are only letting module-b fail. I think the comment is not correct, right? (if so, please also correct the one below)

##########
File path: core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5760ResumeFeatureTest.java
##########
@@ -175,6 +179,112 @@ public void testShouldNotCrashWithoutProject() throws Exception
         }
     }
 
+    public void testFailureWithParallelBuild() throws Exception
+    {
+        Verifier verifier = newVerifier( fourModulesTestDir.getAbsolutePath() );
+        verifier.addCliOption( "-T2" );
+        verifier.addCliOption( "-Dmodule-a.delay=1000" );
+        verifier.addCliOption( "-Dmodule-a.fail=true" );
+        verifier.addCliOption( "-Dmodule-c.fail=true" );
+
+        verifier.executeGoal( "org.apache.maven.plugins:maven-clean-plugin:clean" );
+        verifier.deleteArtifact( "org.apache.maven.its.mng5760", "module-a", "1.0", "jar" );
+        verifier.deleteArtifact( "org.apache.maven.its.mng5760", "module-b", "1.0", "jar" );
+        verifier.deleteArtifact( "org.apache.maven.its.mng5760", "module-c", "1.0", "jar" );
+        verifier.deleteArtifact( "org.apache.maven.its.mng5760", "module-d", "1.0", "jar" );
+
+        try
+        {
+            verifier.executeGoal( "install" );
+            fail( "Expected this invocation to fail" );
+        }
+        catch ( final VerificationException ve )
+        {
+            // Expected to fail.
+            verifier.assertArtifactNotPresent( "org.apache.maven.its.mng5760", "module-a", "1.0", "jar" );
+            verifier.assertArtifactPresent( "org.apache.maven.its.mng5760", "module-b", "1.0", "jar" );
+            verifier.assertArtifactNotPresent( "org.apache.maven.its.mng5760", "module-c", "1.0", "jar" );
+            verifier.assertArtifactNotPresent( "org.apache.maven.its.mng5760", "module-d", "1.0", "jar" );
+        }
+        finally
+        {
+            verifier.resetStreams();
+        }
+
+        // Let module-b and module-c fail, if they would have been built...
+        verifier = newVerifier( fourModulesTestDir.getAbsolutePath() );
+        verifier.addCliOption( "-T2" );
+        verifier.addCliOption( "-Dmodule-b.fail=true" );
+        // ... but adding -r should exclude those two from the build because the previous Maven invocation
+        // marked them as successfully built.
+        verifier.addCliOption( "-r" );
+        try
+        {
+            verifier.executeGoal( "install" );
+            verifier.assertArtifactPresent( "org.apache.maven.its.mng5760", "module-a", "1.0", "jar" );
+            verifier.assertArtifactPresent( "org.apache.maven.its.mng5760", "module-b", "1.0", "jar" );
+            verifier.assertArtifactPresent( "org.apache.maven.its.mng5760", "module-c", "1.0", "jar" );
+            verifier.assertArtifactPresent( "org.apache.maven.its.mng5760", "module-d", "1.0", "jar" );
+        }
+        finally
+        {
+            verifier.resetStreams();
+        }
+    }
+
+    public void testFailureAfterSkipWithParallelBuild() throws Exception
+    {
+        Verifier verifier = newVerifier( fourModulesTestDir.getAbsolutePath() );
+        verifier.addCliOption( "-T2" );
+        verifier.addCliOption( "-Dmodule-b.delay=2000" );
+        verifier.addCliOption( "-Dmodule-d.fail=true" );
+
+        verifier.executeGoal( "org.apache.maven.plugins:maven-clean-plugin:clean" );
+        verifier.deleteArtifact( "org.apache.maven.its.mng5760", "module-a", "1.0", "jar" );
+        verifier.deleteArtifact( "org.apache.maven.its.mng5760", "module-b", "1.0", "jar" );
+        verifier.deleteArtifact( "org.apache.maven.its.mng5760", "module-c", "1.0", "jar" );
+        verifier.deleteArtifact( "org.apache.maven.its.mng5760", "module-d", "1.0", "jar" );
+
+        try
+        {
+            verifier.executeGoals( Arrays.asList( "org.apache.maven.plugins:maven-clean-plugin:clean", "install" ) );

Review comment:
       Clean is not necessary here as you have cleaned it in line 242

##########
File path: core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5760ResumeFeatureTest.java
##########
@@ -175,6 +179,112 @@ public void testShouldNotCrashWithoutProject() throws Exception
         }
     }
 
+    public void testFailureWithParallelBuild() throws Exception
+    {
+        Verifier verifier = newVerifier( fourModulesTestDir.getAbsolutePath() );
+        verifier.addCliOption( "-T2" );
+        verifier.addCliOption( "-Dmodule-a.delay=1000" );
+        verifier.addCliOption( "-Dmodule-a.fail=true" );
+        verifier.addCliOption( "-Dmodule-c.fail=true" );
+
+        verifier.executeGoal( "org.apache.maven.plugins:maven-clean-plugin:clean" );
+        verifier.deleteArtifact( "org.apache.maven.its.mng5760", "module-a", "1.0", "jar" );
+        verifier.deleteArtifact( "org.apache.maven.its.mng5760", "module-b", "1.0", "jar" );
+        verifier.deleteArtifact( "org.apache.maven.its.mng5760", "module-c", "1.0", "jar" );
+        verifier.deleteArtifact( "org.apache.maven.its.mng5760", "module-d", "1.0", "jar" );
+
+        try
+        {
+            verifier.executeGoal( "install" );
+            fail( "Expected this invocation to fail" );
+        }
+        catch ( final VerificationException ve )
+        {
+            // Expected to fail.
+            verifier.assertArtifactNotPresent( "org.apache.maven.its.mng5760", "module-a", "1.0", "jar" );
+            verifier.assertArtifactPresent( "org.apache.maven.its.mng5760", "module-b", "1.0", "jar" );
+            verifier.assertArtifactNotPresent( "org.apache.maven.its.mng5760", "module-c", "1.0", "jar" );
+            verifier.assertArtifactNotPresent( "org.apache.maven.its.mng5760", "module-d", "1.0", "jar" );
+        }
+        finally
+        {
+            verifier.resetStreams();
+        }
+
+        // Let module-b and module-c fail, if they would have been built...
+        verifier = newVerifier( fourModulesTestDir.getAbsolutePath() );
+        verifier.addCliOption( "-T2" );
+        verifier.addCliOption( "-Dmodule-b.fail=true" );
+        // ... but adding -r should exclude those two from the build because the previous Maven invocation
+        // marked them as successfully built.
+        verifier.addCliOption( "-r" );
+        try
+        {
+            verifier.executeGoal( "install" );
+            verifier.assertArtifactPresent( "org.apache.maven.its.mng5760", "module-a", "1.0", "jar" );
+            verifier.assertArtifactPresent( "org.apache.maven.its.mng5760", "module-b", "1.0", "jar" );
+            verifier.assertArtifactPresent( "org.apache.maven.its.mng5760", "module-c", "1.0", "jar" );
+            verifier.assertArtifactPresent( "org.apache.maven.its.mng5760", "module-d", "1.0", "jar" );
+        }
+        finally
+        {
+            verifier.resetStreams();
+        }
+    }
+
+    public void testFailureAfterSkipWithParallelBuild() throws Exception
+    {
+        Verifier verifier = newVerifier( fourModulesTestDir.getAbsolutePath() );
+        verifier.addCliOption( "-T2" );
+        verifier.addCliOption( "-Dmodule-b.delay=2000" );
+        verifier.addCliOption( "-Dmodule-d.fail=true" );
+
+        verifier.executeGoal( "org.apache.maven.plugins:maven-clean-plugin:clean" );
+        verifier.deleteArtifact( "org.apache.maven.its.mng5760", "module-a", "1.0", "jar" );
+        verifier.deleteArtifact( "org.apache.maven.its.mng5760", "module-b", "1.0", "jar" );
+        verifier.deleteArtifact( "org.apache.maven.its.mng5760", "module-c", "1.0", "jar" );
+        verifier.deleteArtifact( "org.apache.maven.its.mng5760", "module-d", "1.0", "jar" );
+
+        try
+        {
+            verifier.executeGoals( Arrays.asList( "org.apache.maven.plugins:maven-clean-plugin:clean", "install" ) );
+            fail( "Expected this invocation to fail" );
+        }
+        catch ( final VerificationException ve )
+        {
+            // Expected to fail.
+            verifier.assertArtifactPresent( "org.apache.maven.its.mng5760", "module-a", "1.0", "jar" );
+            verifier.assertArtifactPresent( "org.apache.maven.its.mng5760", "module-b", "1.0", "jar" );
+            verifier.assertArtifactNotPresent( "org.apache.maven.its.mng5760", "module-c", "1.0", "jar" );
+            verifier.assertArtifactNotPresent( "org.apache.maven.its.mng5760", "module-d", "1.0", "jar" );
+        }
+        finally
+        {
+            verifier.resetStreams();
+        }
+
+        // Let module-b and module-c fail, if they would have been built...

Review comment:
       This should be module-a and module-b, right?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org