You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2018/05/11 12:49:16 UTC

[maven-invoker] branch FIXBUILD_ISSUE updated (371bdae -> efa323e)

This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a change to branch FIXBUILD_ISSUE
in repository https://gitbox.apache.org/repos/asf/maven-invoker.git.


 discard 371bdae  Improved test to be sure to get the correct failure for timeout.
 discard 127b777  Enhanced sleeping time to at least 5 seconds.
 discard b97310e  Recuded timeout value.
 discard ca4ebfb  Added output to check what really happens.
     new efa323e  The tests relying on the exitcode in case of a timeout which is not correct, cause DefaultInvoker results in an Exception instead.

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (371bdae)
            \
             N -- N -- N   refs/heads/FIXBUILD_ISSUE (efa323e)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/test/java/org/apache/maven/shared/invoker/DefaultInvokerTest.java | 3 ---
 1 file changed, 3 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
khmarbaise@apache.org.

[maven-invoker] 01/01: The tests relying on the exitcode in case of a timeout which is not correct, cause DefaultInvoker results in an Exception instead.

Posted by kh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a commit to branch FIXBUILD_ISSUE
in repository https://gitbox.apache.org/repos/asf/maven-invoker.git

commit efa323e14cea9294e26d71a30e30b25cb746aaa6
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Fri May 11 12:29:57 2018 +0200

    The tests relying on the exitcode in case
    of a timeout which is not correct, cause
    DefaultInvoker results in an Exception
    instead.
---
 .../maven/shared/invoker/DefaultInvokerTest.java   | 16 +++++++---
 .../resources/test-build-should-timeout/pom.xml    | 13 +++++++-
 .../org/apache/maven/shared/invoker/AppTest.java   | 37 ++++++----------------
 3 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/src/test/java/org/apache/maven/shared/invoker/DefaultInvokerTest.java b/src/test/java/org/apache/maven/shared/invoker/DefaultInvokerTest.java
index ba51a16..deab040 100644
--- a/src/test/java/org/apache/maven/shared/invoker/DefaultInvokerTest.java
+++ b/src/test/java/org/apache/maven/shared/invoker/DefaultInvokerTest.java
@@ -48,7 +48,7 @@ public class DefaultInvokerTest
         request.setBaseDirectory( basedir );
         request.setDebug( true );
         request.setGoals( Arrays.asList( "clean", "package" ) );
-        
+
         if ( !System.getProperty( "java.version" ).startsWith( "1." ) )
         {
             Properties properties = new Properties();
@@ -74,7 +74,7 @@ public class DefaultInvokerTest
         request.setBaseDirectory( basedir );
         request.setDebug( true );
         request.setGoals( Arrays.asList( "clean", "package" ) );
-        
+
         if ( !System.getProperty( "java.version" ).startsWith( "1." ) )
         {
             Properties properties = new Properties();
@@ -89,7 +89,7 @@ public class DefaultInvokerTest
 
     @Test
     public void testBuildShouldTimeout()
-            throws IOException, MavenInvocationException, URISyntaxException
+        throws IOException, MavenInvocationException, URISyntaxException
     {
         File basedir = getBasedirForBuild();
 
@@ -111,7 +111,12 @@ public class DefaultInvokerTest
 
         InvocationResult result = invoker.execute( request );
 
-        assertEquals( 1, result.getExitCode() );
+        // We check the exception to be sure the failure is based on timeout.
+        assertEquals( "Error while executing external command, process killed.",
+                      result.getExecutionException().getMessage() );
+        // exitCode can't be used cause in case of an timeout it's not correctly
+        // set in DefaultInvoker. Need to think about this.
+        // assertEquals( 1, result.getExitCode() );
     }
 
     @Test
@@ -283,7 +288,8 @@ public class DefaultInvokerTest
 
         if ( dirResource == null )
         {
-            throw new IllegalStateException( "Project: " + dirName + " for test method: " + methodName + " is missing." );
+            throw new IllegalStateException( "Project: " + dirName + " for test method: " + methodName
+                + " is missing." );
         }
 
         return new File( new URI( dirResource.toString() ).getPath() );
diff --git a/src/test/resources/test-build-should-timeout/pom.xml b/src/test/resources/test-build-should-timeout/pom.xml
index d43d9a5..1826d20 100644
--- a/src/test/resources/test-build-should-timeout/pom.xml
+++ b/src/test/resources/test-build-should-timeout/pom.xml
@@ -27,8 +27,19 @@ under the License.
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
-      <version>3.8.2</version>
+      <version>4.12</version>
       <scope>test</scope>
     </dependency>
   </dependencies>
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <version>2.21.0</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
 </project>
diff --git a/src/test/resources/test-build-should-timeout/src/test/java/org/apache/maven/shared/invoker/AppTest.java b/src/test/resources/test-build-should-timeout/src/test/java/org/apache/maven/shared/invoker/AppTest.java
index 3a01f8a..c289090 100644
--- a/src/test/resources/test-build-should-timeout/src/test/java/org/apache/maven/shared/invoker/AppTest.java
+++ b/src/test/resources/test-build-should-timeout/src/test/java/org/apache/maven/shared/invoker/AppTest.java
@@ -1,5 +1,7 @@
 package org.apache.maven.shared.invoker;
 
+import org.junit.Test;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -19,43 +21,24 @@ package org.apache.maven.shared.invoker;
  * under the License.
  */
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 /**
  * Unit test for simple App.
  */
-public class AppTest 
-    extends TestCase
+public class AppTest
 {
-    /**
-     * Create the test case
-     *
-     * @param testName name of the test case
-     */
-    public AppTest( String testName )
-    {
-        super( testName );
-    }
-
-    /**
-     * @return the suite of tests being tested
-     */
-    public static Test suite()
-    {
-        return new TestSuite( AppTest.class );
-    }
 
     /**
      * Not ending test
+     * @throws InterruptedException 
      */
-    public void testApp()
+    @Test
+    public void testApp() throws InterruptedException
     {
-        while (true) {
-            Thread.sleep(1);
+        while ( true )
+        {
+            Thread.sleep( 1000L );
         }
 
-        assertTrue(true);
+//        assertTrue(  true );
     }
 }

-- 
To stop receiving notification emails like this one, please contact
khmarbaise@apache.org.