diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-11-11 12:22:53 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-11-11 12:23:19 +0100 |
commit | fcdefb9e0944be78742d18fd3e02a81f882db864 (patch) | |
tree | e1e6cc4648304970592d3bff19a5830422bc7dda /server | |
parent | 103982f1e5a6a2e6484241e814bfb0ef082dce71 (diff) | |
download | sonarqube-fcdefb9e0944be78742d18fd3e02a81f882db864.tar.gz sonarqube-fcdefb9e0944be78742d18fd3e02a81f882db864.zip |
Improve stability of ProcessUtilsTest on slow box
Diffstat (limited to 'server')
-rw-r--r-- | server/sonar-process/src/test/java/org/sonar/process/ProcessUtilsTest.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/server/sonar-process/src/test/java/org/sonar/process/ProcessUtilsTest.java b/server/sonar-process/src/test/java/org/sonar/process/ProcessUtilsTest.java index 01fb917d80c..1db07dd3213 100644 --- a/server/sonar-process/src/test/java/org/sonar/process/ProcessUtilsTest.java +++ b/server/sonar-process/src/test/java/org/sonar/process/ProcessUtilsTest.java @@ -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); } |