SLING-5303 : adding a few more loops to avoid a failure that happened on jenkins due to the fact that heartbeatsAndCheckView can throw exceptions when invoked during promotion/other repository changes in a test environment. More loops should help work around that.

git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1714654 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/test/java/org/apache/sling/discovery/base/its/AbstractClusterTest.java b/src/test/java/org/apache/sling/discovery/base/its/AbstractClusterTest.java
index 0608440..6b25821 100644
--- a/src/test/java/org/apache/sling/discovery/base/its/AbstractClusterTest.java
+++ b/src/test/java/org/apache/sling/discovery/base/its/AbstractClusterTest.java
@@ -1305,16 +1305,14 @@
         instance3 = newBuilder().setDebugName("thirdInstance")
                 .useRepositoryOf(instance1)
                 .build();
-        instance1.heartbeatsAndCheckView();
-        instance2.heartbeatsAndCheckView();
-        instance3.heartbeatsAndCheckView();
-        logger.info("testAdditionalInstance: 3rd 2s sleep");
-        Thread.sleep(2000);
-        instance1.heartbeatsAndCheckView();
-        instance2.heartbeatsAndCheckView();
-        instance3.heartbeatsAndCheckView();
-        logger.info("testAdditionalInstance: 4th 2s sleep");
-        Thread.sleep(3000);
+        for(int i=0; i<4; i++) {
+            instance1.heartbeatsAndCheckView();
+            instance2.heartbeatsAndCheckView();
+            instance3.heartbeatsAndCheckView();
+            logger.info("testAdditionalInstance: i="+i+", 2s sleep");
+            Thread.sleep(2000);
+        }
+
         assertEquals(1, acceptsMultiple.getEventCnt(Type.TOPOLOGY_CHANGING));
         assertEquals(1, acceptsMultiple.getEventCnt(Type.TOPOLOGY_CHANGED));
         logger.info("testAdditionalInstance: end");