diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-05-12 14:18:41 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-05-12 14:18:41 +0200 |
commit | c3f190771bfaf1104985bdec74391599956bc66e (patch) | |
tree | 195a649e5ae93330765445738e46609ef09f601f /server/sonar-ce/src | |
parent | c701c420ca241c9de6e3a72ce18128c6840fa156 (diff) | |
download | sonarqube-c3f190771bfaf1104985bdec74391599956bc66e.tar.gz sonarqube-c3f190771bfaf1104985bdec74391599956bc66e.zip |
Consistent safeguard timeouts in JUnit tests
Diffstat (limited to 'server/sonar-ce/src')
3 files changed, 7 insertions, 3 deletions
diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/app/CeServerTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/app/CeServerTest.java index 758c0eaf92d..c2a7f45c965 100644 --- a/server/sonar-ce/src/test/java/org/sonar/ce/app/CeServerTest.java +++ b/server/sonar-ce/src/test/java/org/sonar/ce/app/CeServerTest.java @@ -27,7 +27,9 @@ import javax.annotation.Nullable; import org.junit.After; import org.junit.Rule; import org.junit.Test; +import org.junit.rules.DisableOnDebug; import org.junit.rules.ExpectedException; +import org.junit.rules.TestRule; import org.junit.rules.Timeout; import org.mockito.Mockito; import org.sonar.ce.ComputeEngine; @@ -41,7 +43,7 @@ import static org.mockito.Mockito.mock; public class CeServerTest { @Rule - public Timeout timeout = Timeout.seconds(50); + public TestRule safeguardTimeout = new DisableOnDebug(Timeout.seconds(60)); @Rule public ExpectedException expectedException = ExpectedException.none(); diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/cluster/HazelcastClientWrapperImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/cluster/HazelcastClientWrapperImplTest.java index 75877871fa3..746b31960f6 100644 --- a/server/sonar-ce/src/test/java/org/sonar/ce/cluster/HazelcastClientWrapperImplTest.java +++ b/server/sonar-ce/src/test/java/org/sonar/ce/cluster/HazelcastClientWrapperImplTest.java @@ -60,7 +60,7 @@ public class HazelcastClientWrapperImplTest { public ExpectedException expectedException = ExpectedException.none(); @Rule - public TestRule safeGuard = new DisableOnDebug(Timeout.seconds(20)); + public TestRule safeguardTimeout = new DisableOnDebug(Timeout.seconds(60)); private static HazelcastInstance hzCluster; private static HazelcastClientWrapperImpl hzClient; diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImplTest.java index 43585cf63d1..355fd1c8267 100644 --- a/server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImplTest.java +++ b/server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImplTest.java @@ -44,6 +44,8 @@ import javax.annotation.Nullable; import javax.annotation.concurrent.Immutable; import org.junit.Rule; import org.junit.Test; +import org.junit.rules.DisableOnDebug; +import org.junit.rules.TestRule; import org.junit.rules.Timeout; import org.sonar.ce.configuration.CeConfigurationRule; @@ -64,7 +66,7 @@ public class CeProcessingSchedulerImplTest { @Rule // due to risks of infinite chaining of tasks/futures, a timeout is required for safety - public Timeout timeout = Timeout.seconds(60); + public TestRule safeguardTimeout = new DisableOnDebug(Timeout.seconds(60)); @Rule public CeConfigurationRule ceConfiguration = new CeConfigurationRule(); // Required to prevent an infinite loop |