Vladsz83 commented on code in PR #11327:
URL: https://github.com/apache/ignite/pull/11327#discussion_r1598863995


##########
modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryNetworkIssuesTest.java:
##########
@@ -383,6 +415,54 @@ private void simulateFailureOfTwoNodes(boolean 
sequentionally) throws Exception
         }
     }
 
+    /**
+     * This test uses node failure by stopping service threads, which makes 
the node unresponsive and results in
+     * failing connection to the server.
+     *
+     * @throws Exception If failed.
+     * @see TcpDiscoverySpi#simulateNodeFailure()
+     */
+    @Test
+    public void testCheckNodeFailureSocketConnectionLogMessage() throws 
Exception {
+        ListeningTestLogger testLog = new ListeningTestLogger(log);
+
+        Collection<LogListener> lsnrs = new ArrayList<>();
+
+        lsnrs.add(LogListener.matches("Checking connection to 
node").andMatches("result=failed").times(1).build());
+        lsnrs.add(LogListener.matches("Connection check to previous node 
failed").times(1).build());
+
+        lsnrs.forEach(testLog::registerListener);
+
+        TcpDiscoverySpi spi0 = new TcpDiscoverySpi();
+
+        startGrid(getTestConfigWithSpi(spi0, "ignite-0"));
+
+        IgniteConfiguration cfg1 = getTestConfigWithSpi(new TcpDiscoverySpi(), 
"ignite-1");
+        cfg1.setGridLogger(testLog);
+
+        startGrid(cfg1);
+
+        startGrid(getTestConfigWithSpi(new TcpDiscoverySpi(), "ignite-2"));
+
+        spi0.simulateNodeFailure();
+
+        for (LogListener lsnr : lsnrs)
+            waitForCondition(lsnr::check, getTestTimeout());
+
+        testLog.clearListeners();
+    }
+
+    /**
+     * Returns default {@link IgniteConfiguration} with specified ignite 
instance name and {@link TcpDiscoverySpi}.
+     * @param spi {@link TcpDiscoverySpi}
+     * @param igniteInstanceName ignite instance name
+     * @return {@link IgniteConfiguration}
+     * @throws Exception If failed.
+     */
+    private IgniteConfiguration getTestConfigWithSpi(TcpDiscoverySpi spi, 
String igniteInstanceName) throws Exception {

Review Comment:
   Let's remove this function. We can use `specialSpi=` if required.



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