zk
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c6715c55 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c6715c55 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c6715c55 Branch: refs/heads/ignite-zk Commit: c6715c55e38f3c034628e17f7df38c3100d21610 Parents: bf9b90f Author: sboikov <sboi...@gridgain.com> Authored: Tue Dec 26 10:33:22 2017 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Tue Dec 26 10:33:22 2017 +0300 ---------------------------------------------------------------------- .../ZookeeperDiscoverySpiBasicTest.java | 49 ++++++++++++++++++-- .../zookeeper/ZkTestClientCnxnSocketNIO.java | 2 +- 2 files changed, 45 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c6715c55/modules/core/src/test/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoverySpiBasicTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoverySpiBasicTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoverySpiBasicTest.java index a542a7a..390af51 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoverySpiBasicTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoverySpiBasicTest.java @@ -2592,6 +2592,47 @@ public class ZookeeperDiscoverySpiBasicTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + public void testReconnectDisabled_ConnectionLost() throws Exception { + clientReconnectDisabled = true; + + startGrid(0); + + sesTimeout = 3000; + testSockNio = true; + client = true; + + Ignite client = startGrid(1); + + final CountDownLatch latch = new CountDownLatch(1); + + client.events().localListen(new IgnitePredicate<Event>() { + @Override public boolean apply(Event evt) { + latch.countDown(); + + return false; + } + }, EventType.EVT_NODE_SEGMENTED); + + ZkTestClientCnxnSocketNIO nio = ZkTestClientCnxnSocketNIO.forNode(client); + + nio.closeSocket(true); + + try { + waitNoAliveZkNodes(log, + zkCluster.getConnectString(), + Collections.singletonList(aliveZkNodePath(client)), + 10_000); + } + finally { + nio.allowConnect(); + } + + assertTrue(latch.await(10, SECONDS)); + } + + /** + * @throws Exception If failed. + */ public void testServersLeft_FailOnTimeout() throws Exception { startGrid(0); @@ -2605,16 +2646,14 @@ public class ZookeeperDiscoverySpiBasicTest extends GridCommonAbstractTest { waitForTopology(CLIENTS + 1); - final CountDownLatch l = new CountDownLatch(CLIENTS); + final CountDownLatch latch = new CountDownLatch(CLIENTS); for (int i = 0; i < CLIENTS; i++) { Ignite node = ignite(i + 1); node.events().localListen(new IgnitePredicate<Event>() { @Override public boolean apply(Event evt) { - info("Segmented!"); - - l.countDown(); + latch.countDown(); return false; } @@ -2623,7 +2662,7 @@ public class ZookeeperDiscoverySpiBasicTest extends GridCommonAbstractTest { stopGrid(getTestIgniteInstanceName(0), true, false); - assertTrue(l.await(10, SECONDS)); + assertTrue(latch.await(10, SECONDS)); evts.clear(); } http://git-wip-us.apache.org/repos/asf/ignite/blob/c6715c55/modules/core/src/test/java/org/apache/zookeeper/ZkTestClientCnxnSocketNIO.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/zookeeper/ZkTestClientCnxnSocketNIO.java b/modules/core/src/test/java/org/apache/zookeeper/ZkTestClientCnxnSocketNIO.java index b8e1c80..7892b5e 100644 --- a/modules/core/src/test/java/org/apache/zookeeper/ZkTestClientCnxnSocketNIO.java +++ b/modules/core/src/test/java/org/apache/zookeeper/ZkTestClientCnxnSocketNIO.java @@ -113,7 +113,7 @@ public class ZkTestClientCnxnSocketNIO extends ClientCnxnSocketNIO { * */ public void allowConnect() { - assert blockConnectLatch != null && blockConnectLatch.getCount() == 1; + assert blockConnectLatch != null && blockConnectLatch.getCount() == 1 : blockConnectLatch; log.info("ZkTestClientCnxnSocketNIO allowConnect [node=" + nodeName + ']');