This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.discovery.base-1.0.2
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-discovery-base.git

commit 479ea55dc5ac3e347f021f333f06c5a30e8bd5c6
Author: Stefan Egli <[email protected]>
AuthorDate: Thu Oct 29 14:17:56 2015 +0000

    SLING-5126 / SLING-5195 related: fixing a test
    
    git-svn-id: 
https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/discovery/base@1711275
 13f79535-47bb-0310-9956-ffa450edef68
---
 .../discovery/base/its/AbstractClusterTest.java    | 30 +++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

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 31c3b36..044f556 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
@@ -444,8 +444,22 @@ public abstract class AbstractClusterTest {
         for(int i=0; i<25; i++) {
             runHeartbeatOnceWith(instance1Restarted, instance2, instance3, 
instance5);
             instance1.getViewChecker().checkView();
-            assertTrue(pingConnector(instance3, instance2));
-            assertTrue(pingConnector(instance5, instance2));
+            // we used to do:
+            //assertTrue(pingConnector(instance3, instance2));
+            // but that could fail with the introduction of marking
+            // an establishedView as failing upon detecting a view change
+            // when the view changes, we're sending TOPOLOGY_CHANGING to 
listeners
+            // so getTopology() should also return isCurrent==false - which
+            // means that doing a ping will also fail, cos that wants to 
+            // get a current topology to send as an announcement.
+            // which is a long way of saying: we cannot do an assert here
+            // since instance3 *can* have an undefined cluster view..
+            try{
+                pingConnector(instance3, instance2);
+            } catch(UndefinedClusterViewException ucve) {
+                // ignore
+            }
+            pingConnector(instance5, instance2);
             final TopologyView topology = 
instance3.getDiscoveryService().getTopology();
             InstanceDescription i3 = null;
             for (Iterator<InstanceDescription> it = 
topology.getInstances().iterator(); it.hasNext();) {
@@ -592,7 +606,17 @@ public abstract class AbstractClusterTest {
                 .setMinEventDelay(MIN_EVENT_DELAY).build();
         for(int i=0; i<3; i++) {
             runHeartbeatOnceWith(instance1Restarted, instance2, instance3, 
instance4, instance5);
-            assertTrue(pingConnector(instance3, instance2));
+            Thread.sleep(250);
+            // since instance4 just started - hooked to instance3 
+            // it is possible that it doesn't just have a topology
+            // yet - so we cannot do:
+            //assertTrue(pingConnector(instance3, instance2));
+            // but instead do
+            try{
+                pingConnector(instance3, instance2);
+            } catch(UndefinedClusterViewException ucve) {
+                // ignore
+            }
             assertTrue(pingConnector(instance5, instance2));
         }
 

-- 
To stop receiving notification emails like this one, please contact
"[email protected]" <[email protected]>.

Reply via email to