ZookeeperIpFinderTest.testFourNodesKillRestartZookeeper fails sometimes
@@ -32,8 +32,6 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
-import org.apache.ignite.internal.util.lang.GridAbsPredicate;
-import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.testframework.GridTestUtils;
@@ -356,24 +354,24 @@ public class ZookeeperIpFinderTest extends GridCommonAbstractTest {
// block the client until connected
zkCurator.blockUntilConnected();
- // check that the nodes have registered again
+ // Check that the nodes have registered again with the previous configuration.
assertEquals(4, zkCurator.getChildren().forPath(SERVICES_IGNITE_ZK_PATH).size());
- // stop all grids
- stopAllGrids();
+ // Block the clients until connected.
+ for (int i = 0; i < 4; i++) {
+ TcpDiscoverySpi spi = (TcpDiscoverySpi)grid(i).configuration().getDiscoverySpi();
- assertTrue(GridTestUtils.waitForCondition(new GridAbsPredicate() {
- @Override public boolean apply() {
- try {
- return 0 == zkCurator.getChildren().forPath(SERVICES_IGNITE_ZK_PATH).size();
- }
- catch (Exception e) {
- U.error(log, "Failed to wait for zk condition", e);
+ TcpDiscoveryZookeeperIpFinder zkIpFinder = (TcpDiscoveryZookeeperIpFinder)spi.getIpFinder();
- return false;
- }
+ CuratorFramework curator = GridTestUtils.getFieldValue(zkIpFinder, "curator");
+
+ curator.blockUntilConnected();
}
- }, 20000));
+
+ // stop all grids
+ stopAllGrids();
+
+ assertEquals(0, zkCurator.getChildren().forPath(SERVICES_IGNITE_ZK_PATH).size());
}
/**
