diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-06-06 16:08:51 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-06-06 16:08:56 +0200 |
commit | a59693a67061ea3ccc8fbf9d5740ae0b8ab6a79a (patch) | |
tree | 35b451649f4c599d45a5b20bf0be6f1b0db91432 /sonar-plugin-api | |
parent | 8c03ea31355894d2d9fb3625c5c731b8a621ebe8 (diff) | |
download | sonarqube-a59693a67061ea3ccc8fbf9d5740ae0b8ab6a79a.tar.gz sonarqube-a59693a67061ea3ccc8fbf9d5740ae0b8ab6a79a.zip |
Fix unstability of CommandExecutorTest
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r-- | sonar-plugin-api/src/test/java/org/sonar/api/utils/command/CommandExecutorTest.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/command/CommandExecutorTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/command/CommandExecutorTest.java index 3eaca6e0072..e61f87c0e00 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/command/CommandExecutorTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/command/CommandExecutorTest.java @@ -132,9 +132,12 @@ public class CommandExecutorTest { fail(); } catch (TimeoutException e) { long duration = System.currentTimeMillis() - start; - // should test >= 300 but it strangly fails during build on windows. - // The timeout is raised after 297ms (??) - assertThat(duration).as(e.getMessage()).isGreaterThan(290L); + // Future.get(), which is used by CommandExecutor, has not a precise timeout. + // See http://stackoverflow.com/questions/23199820/future-get-timeout-precision-and-possible-alternatives + // The deviation seems to be in both directions, so it implies to test something like >270ms instead of >300ms + assertThat(duration).as(e.getMessage()) + .isGreaterThan(270L) + .isLessThan(400L); } } |