]> source.dussan.org Git - sonarqube.git/commitdiff
Improve stability of ProcessUtilsTest on slow box
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 11 Nov 2016 11:22:53 +0000 (12:22 +0100)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 11 Nov 2016 11:23:19 +0000 (12:23 +0100)
server/sonar-process/src/test/java/org/sonar/process/ProcessUtilsTest.java

index 01fb917d80ca681d040d9db05797189cf3e6c79a..1db07dd3213830b0bb3c0901fe8b1935346849de 100644 (file)
@@ -19,7 +19,9 @@
  */
 package org.sonar.process;
 
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.Timeout;
 import org.sonar.test.TestUtils;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -27,6 +29,9 @@ import static org.sonar.process.ProcessUtils.awaitTermination;
 
 public class ProcessUtilsTest {
 
+  @Rule
+  public Timeout timeout= Timeout.seconds(5);
+
   @Test
   public void private_constructor() {
     assertThat(TestUtils.hasOnlyPrivateConstructors(ProcessUtils.class)).isTrue();
@@ -37,12 +42,12 @@ public class ProcessUtilsTest {
     awaitTermination((Thread) null);
   }
 
-  @Test(timeout = 250L)
+  @Test
   public void awaitTermination_does_not_wait_on_currentThread() {
     awaitTermination(Thread.currentThread());
   }
 
-  @Test(timeout = 3_000L)
+  @Test
   public void awaitTermination_ignores_interrupted_exception_of_current_thread() throws InterruptedException {
     final EverRunningThread runningThread = new EverRunningThread();
     final Thread safeJoiner = new Thread() {
@@ -89,7 +94,7 @@ public class ProcessUtilsTest {
     safeJoiner.join();
   }
 
-  @Test(timeout = 1_000L)
+  @Test
   public void awaitTermination_of_vararg_does_not_fail_when_there_is_a_null_or_current_thread() {
     awaitTermination(null, Thread.currentThread(), null);
   }