You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2020/04/07 20:24:33 UTC

[maven-integration-testing] 24/24: Share a bit more context why we're doing the ugly Thread.sleep

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

rfscholte pushed a commit to branch MGN-4660
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git

commit dc100af1b64ce0b4c2876dc8f443c30d565172e9
Author: Maarten Mulders <ma...@infosupport.com>
AuthorDate: Tue Apr 7 21:29:38 2020 +0200

    Share a bit more context why we're doing the ugly Thread.sleep
---
 .../maven/it/MavenITmng4660OutdatedPackagedArtifact.java      | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660OutdatedPackagedArtifact.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660OutdatedPackagedArtifact.java
index 983a112..afc46de 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660OutdatedPackagedArtifact.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660OutdatedPackagedArtifact.java
@@ -63,10 +63,13 @@ public class MavenITmng4660OutdatedPackagedArtifact extends AbstractMavenIntegra
         verifier1.assertFilePresent( module1Jar.toString() );
         verifier1.resetStreams();
 
-        // Simulating the delay between two invocations. It also makes sure we're not hit by tests that run so fast,
-        // that the difference in file modification time (see below) is too small to observe. Some combinations of OS
-        // and filesystem return that value with "just" second precision, which is not detailed enough.
-        Thread.sleep(1_000);
+        if ( System.getProperty( "java.version", "" ).startsWith( "1." ) )
+        {
+            // Simulating the delay between two invocations. It also makes sure we're not hit by tests that run so fast,
+            // that the difference in file modification time (see below) is too small to observe. Java 8 on Linux and
+            // macOS returns that value with "just" second precision, which is not detailed enough.
+            Thread.sleep( 1_000 );
+        }
 
         // 2. Create a properties file with some content and compile only that module (module A).
         final Verifier verifier2 = newVerifier( testDir.getAbsolutePath() );