aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorEric Hartmann <hartmann.eric@gmail.com>2017-05-16 13:33:25 +0200
committerEric Hartmann <hartmann.eric@gmail.com>2017-05-16 13:33:25 +0200
commit266a2434f2d357338d8f35eca6f1554cbeac0413 (patch)
treec31c9c09178d1a9e1fe1a5ebed6eff3a0beef0e0 /server
parent1271c3adf0c522c18053b4de3c22cf8c8cee777e (diff)
downloadsonarqube-266a2434f2d357338d8f35eca6f1554cbeac0413.tar.gz
sonarqube-266a2434f2d357338d8f35eca6f1554cbeac0413.zip
Make Hazelcast test more robust
Diffstat (limited to 'server')
-rw-r--r--server/sonar-process-monitor/src/test/java/org/sonar/application/cluster/HazelcastClusterTest.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/server/sonar-process-monitor/src/test/java/org/sonar/application/cluster/HazelcastClusterTest.java b/server/sonar-process-monitor/src/test/java/org/sonar/application/cluster/HazelcastClusterTest.java
index cc8a0baab1c..28103e103d8 100644
--- a/server/sonar-process-monitor/src/test/java/org/sonar/application/cluster/HazelcastClusterTest.java
+++ b/server/sonar-process-monitor/src/test/java/org/sonar/application/cluster/HazelcastClusterTest.java
@@ -48,6 +48,7 @@ import org.sonar.process.ProcessId;
import org.sonar.process.ProcessProperties;
import org.sonar.process.cluster.ClusterObjectKeys;
+import static junit.framework.TestCase.fail;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.timeout;
@@ -169,9 +170,11 @@ public class HazelcastClusterTest {
}, false);
hzClient.shutdown();
- latch.await(1, TimeUnit.SECONDS);
-
- assertThat(hzCluster.hzInstance.getSet(ClusterObjectKeys.CLIENT_UUIDS)).isEmpty();
+ if (latch.await(5, TimeUnit.SECONDS)) {
+ assertThat(hzCluster.hzInstance.getSet(ClusterObjectKeys.CLIENT_UUIDS).size()).isEqualTo(0);
+ } else {
+ fail("The client UUID have not been removed from the Set within 5 seconds' time lapse");
+ }
}
}