You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2022/02/01 19:00:22 UTC

[maven-surefire] branch master updated: [JUnit47ParallelIT.forcedShutdownVerifyingLogs] The logs do not have to match "These tests were executed in prior to the shutdown operation:" if the interrupted tests were finished fast enough. If this error message appears then the next line has to list the name of the class with tests in progress.

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

tibordigana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git


The following commit(s) were added to refs/heads/master by this push:
     new c2da914  [JUnit47ParallelIT.forcedShutdownVerifyingLogs] The logs do not have to match "These tests were executed in prior to the shutdown operation:" if the interrupted tests were finished fast enough. If this error message appears then the next line has to list the name of the class with tests in progress.
c2da914 is described below

commit c2da9140230ae476f30e895047ab8df69b621abb
Author: Tibor Digaňa <ti...@apache.org>
AuthorDate: Tue Feb 1 19:59:56 2022 +0100

    [JUnit47ParallelIT.forcedShutdownVerifyingLogs] The logs do not have to match "These tests were executed in prior to the shutdown operation:" if the interrupted tests were finished fast enough. If this error message appears then the next line has to list the name of the class with tests in progress.
---
 .../maven/surefire/its/JUnit47ParallelIT.java      | 34 +++++++++++++++++-----
 1 file changed, 27 insertions(+), 7 deletions(-)

diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit47ParallelIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit47ParallelIT.java
index e612196..6f25678 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit47ParallelIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit47ParallelIT.java
@@ -19,10 +19,15 @@ package org.apache.maven.surefire.its;
  * under the License.
  */
 
+import org.apache.maven.surefire.its.fixture.OutputValidator;
 import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
 import org.apache.maven.surefire.its.fixture.SurefireLauncher;
 import org.junit.Test;
 
+import java.util.Iterator;
+
+import static org.fest.assertions.Assertions.assertThat;
+
 /**
  * Testing JUnitCoreWrapper with ParallelComputerBuilder.
  *
@@ -514,18 +519,33 @@ public class JUnit47ParallelIT extends SurefireJUnit4IntegrationTestCase
 
     @Test
     public void forcedShutdownVerifyingLogs()
+        throws Exception
     {
         // attempts to run for 2.4 sec until timeout has elapsed
-        unpack().parallelMethods().threadCountMethods(
-                3 ).disablePerCoreThreadCount().parallelTestsTimeoutForcedInSeconds( 1.05d ).setTestToRun(
-                "Waiting*Test" ).failNever().executeTest().verifyTextInLog(
-                "The test run has finished abruptly after timeout of 1.05 seconds." ).verifyTextInLog(
-                "These tests were executed in prior to the shutdown operation:" ).verifyTextInLog(
-                "These tests are incomplete:" );
+        OutputValidator validator = unpack()
+            .parallelMethods()
+            .threadCountMethods( 3 )
+            .disablePerCoreThreadCount()
+            .parallelTestsTimeoutForcedInSeconds( 1.05d )
+            .setTestToRun( "Waiting*Test" )
+            .failNever()
+            .executeTest()
+            .verifyTextInLog( "The test run has finished abruptly after timeout of 1.05 seconds." )
+            .verifyTextInLog( "These tests were executed in prior to the shutdown operation:" );
+
+        for ( Iterator<String> it = validator.loadLogLines().iterator(); it.hasNext(); )
+        {
+            String line = it.next();
+            if ( line.contains( "These tests are incomplete:" ) )
+            {
+                assertThat( it.hasNext() ).isTrue();
+                assertThat( it.next() ).matches( "^.*\\s+surefireparallel\\.Waiting(\\d{1,1})Test$" );
+            }
+        }
     }
 
     private SurefireLauncher unpack()
     {
         return unpack( "junit47-parallel" ).showErrorStackTraces().forkOnce().redirectToFile( false );
     }
-}
\ No newline at end of file
+}