Vladsz83 commented on a change in pull request #8881:
URL: https://github.com/apache/ignite/pull/8881#discussion_r704794484



##########
File path: 
modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
##########
@@ -412,6 +416,60 @@ 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 NetFailureTcpDiscoverySpi());
+
+            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);
+            }
+
+            U.sleep(failureDetectionTimeout * 2);

Review comment:
       Why?

##########
File path: 
modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
##########
@@ -412,6 +416,60 @@ 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 NetFailureTcpDiscoverySpi());
+
+            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);
+            }
+
+            U.sleep(failureDetectionTimeout * 2);
+
+            NetFailureTcpDiscoverySpi failSpi = 
((NetFailureTcpDiscoverySpi)grid(gridCnt - 1)
+                .configuration().getDiscoverySpi());
+
+            long simulatedNetDelay = ((TcpDiscoverySpi)grid(gridCnt - 
1).configuration()
+                .getDiscoverySpi()).getEffectiveConnectionRecoveryTimeout() / 
gridCnt;
+
+            failSpi.setNetworkTimeout(1, (int)simulatedNetDelay);
+
+            testWaiter.await(failureDetectionTimeout * 3, MILLISECONDS);

Review comment:
       Why?




-- 
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]


Reply via email to