Vladsz83 commented on code in PR #11327:
URL: https://github.com/apache/ignite/pull/11327#discussion_r1599908158
##########
modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryNetworkIssuesTest.java:
##########
@@ -383,6 +413,46 @@ 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. Failures are simulated on the 1st
node in the ring. In this case,
+ * the 2nd node in the ring will trigger 'Backward Connection Check',
which should result in failing attempt of connection.
+ * This result is followed by the corresponding logs, indicating described
failures. The test verifies the logs.
+ *
+ * @throws Exception If failed.
+ */
+ @Test
+ public void testBackwardConnectionCheckFailedLogMessage() throws Exception
{
+ ListeningTestLogger testLog = new ListeningTestLogger(log);
+
+ LogListener lsnr0 = LogListener.matches("Checking connection to
node").andMatches("result=failed").times(1).build();
+ LogListener lsnr1 = LogListener.matches("Connection check to previous
node failed").times(1).build();
+
+ testLog.registerListener(lsnr0);
+ testLog.registerListener(lsnr1);
+
+ startGrid(0);
+
+ IgniteConfiguration cfg =
getConfiguration(getTestIgniteInstanceName(1));
+ cfg.setGridLogger(testLog);
+
+ startGrid(cfg);
+
+ startGrid(2);
+
+ spi(grid(0)).simulateNodeFailure();
+
+ waitForCondition(lsnr0::check, getTestTimeout());
+ waitForCondition(lsnr1::check, getTestTimeout());
+
+ for (int i = 1; i < 2; ++i) {
+ int finalI = i;
Review Comment:
Suggestion: lets change to:
for (Ignite ig : Arrays.asList(grid(1), grid(2))) {
waitForCondition(() -> ig.cluster().nodes().size() == 2,
getTestTimeout());
assertTrue(F.viewReadOnly(ig.cluster().nodes(), n -> n, n ->
n.order() == 1).isEmpty());
}
--
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]