diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-11-22 14:03:12 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-11-22 14:03:12 +0100 |
commit | 78d521cc0a67d0dc406ccd659a86f839042a12b0 (patch) | |
tree | c9dcb025991046de2bc071a708c27c72c5ac986b | |
parent | db1782ebbbc939257ffe074afc255c8183db4e13 (diff) | |
download | sonarqube-78d521cc0a67d0dc406ccd659a86f839042a12b0.tar.gz sonarqube-78d521cc0a67d0dc406ccd659a86f839042a12b0.zip |
Improve reliability of WebhookCallerImplTest
-rw-r--r-- | server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/webhook/WebhookCallerImplTest.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/webhook/WebhookCallerImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/webhook/WebhookCallerImplTest.java index ef4dd6d53ad..a8404841b96 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/webhook/WebhookCallerImplTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/webhook/WebhookCallerImplTest.java @@ -24,6 +24,7 @@ import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; import org.junit.Rule; import org.junit.Test; +import org.junit.rules.Timeout; import org.sonar.api.SonarQubeSide; import org.sonar.api.SonarRuntime; import org.sonar.api.config.MapSettings; @@ -44,6 +45,8 @@ public class WebhookCallerImplTest { @Rule public MockWebServer server = new MockWebServer(); + @Rule + public Timeout timeout = Timeout.seconds(60); private System2 system = new TestSystem2().setNow(NOW); @@ -81,7 +84,8 @@ public class WebhookCallerImplTest { assertThat(delivery.getHttpStatus()).isEmpty(); assertThat(delivery.getDurationInMs()).isEmpty(); - assertThat(delivery.getErrorMessage().get()).startsWith("Failed to connect"); + // message can be "Failed to connect" or "connect timed out" + assertThat(delivery.getErrorMessage().get()).contains("connect"); assertThat(delivery.getAt()).isEqualTo(NOW); assertThat(delivery.getWebhook()).isSameAs(webhook); assertThat(delivery.getPayload()).isSameAs(payload); |