]> source.dussan.org Git - sonarqube.git/commitdiff
Make Hazelcast test more robust
authorEric Hartmann <hartmann.eric@gmail.com>
Tue, 16 May 2017 11:33:25 +0000 (13:33 +0200)
committerEric Hartmann <hartmann.eric@gmail.com>
Tue, 16 May 2017 11:33:25 +0000 (13:33 +0200)
server/sonar-process-monitor/src/test/java/org/sonar/application/cluster/HazelcastClusterTest.java

index cc8a0baab1cae3072ba3f3af87ca655dfc032068..28103e103d8d2e9b12391683e2726fb5a42daa00 100644 (file)
@@ -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");
+      }
     }
   }