Vladsz83 commented on a change in pull request #8881:
URL: https://github.com/apache/ignite/pull/8881#discussion_r666264874
##########
File path:
modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
##########
@@ -412,6 +416,58 @@ public void testFailureDetectionOnNodePing2() throws
Exception {
}
}
+ /**
+ * Checks that node leaves the cluster after lose of outgoing connections.
+ *
+ * @throws Exception If any error occurs.
+ */
+ @Test
+ public void testOutgoingConnectionsFailure() throws Exception {
+ try {
+ final int gridCnt = 4;
+
+ failureDetectionTimeout = 2000;
+
+ startGrids(gridCnt - 1);
+
+ nodeSpi.set(new FailureSimulatingTcpDiscoverySpi());
+
+ startGrid(gridCnt - 1);
+
+ UUID failingNodeId = grid(gridCnt - 1).localNode().id();
+
+ CountDownLatch testWaiter = new CountDownLatch(gridCnt - 1);
+
+ for (int i = 0; i < gridCnt - 1; ++i) {
+ grid(0).events().localListen(new IgnitePredicate<Event>() {
+ @Override public boolean apply(Event evt) {
+ if (evt.type() == EventType.EVT_NODE_FAILED
+ &&
failingNodeId.equals(((DiscoveryEvent)evt).eventNode().id()))
+ testWaiter.countDown();
+
+ return false;
+ }
+ }, EVT_NODE_FAILED);
+ }
+
+ FailureSimulatingTcpDiscoverySpi failSpi =
((FailureSimulatingTcpDiscoverySpi)grid(gridCnt - 1)
+ .configuration().getDiscoverySpi());
+
+ long simulatedNetDelay = ((TcpDiscoverySpi)grid(gridCnt -
1).configuration()
+ .getDiscoverySpi()).getEffectiveConnectionRecoveryTimeout() /
gridCnt;
+
+ failSpi.enableNetworkTimeoutSimulation(1, (int)simulatedNetDelay);
+
+ testWaiter.await(failureDetectionTimeout * 3, MILLISECONDS);
+
+ for (int i = 0; i < gridCnt - 1; ++i)
+ assert grid(i).cluster().nodes().size() == gridCnt - 1;
Review comment:
We wait for every other node to get NODE_FAILED message. Isn't it the
best approach?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]