Repository: ignite Updated Branches: refs/heads/master 250bbff6d -> e1a62b2f0
IGNITE-172 [Test] [Rare] GridTcpCommunicationSpiRecoveryAckSelfTest and IgniteTcpCommunicationRecoveryAckClosureSelfTest Signed-off-by: Anton Vinogradov <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e1a62b2f Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e1a62b2f Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e1a62b2f Branch: refs/heads/master Commit: e1a62b2f0a6cca67b39af877838015fb38333d23 Parents: 250bbff Author: NSAmelchev <[email protected]> Authored: Thu May 17 11:38:48 2018 +0300 Committer: Anton Vinogradov <[email protected]> Committed: Thu May 17 11:38:48 2018 +0300 ---------------------------------------------------------------------- ...CommunicationRecoveryAckClosureSelfTest.java | 26 ++++++++++++++------ 1 file changed, 19 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/e1a62b2f/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java index d1689bd..1c2bf04 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java @@ -258,8 +258,6 @@ public class IgniteTcpCommunicationRecoveryAckClosureSelfTest<T extends Communic * @throws Exception If failed. */ public void testQueueOverflow() throws Exception { - fail("https://issues.apache.org/jira/browse/IGNITE-172"); - for (int i = 0; i < 3; i++) { try { startSpis(5, 60_000, 10); @@ -300,8 +298,17 @@ public class IgniteTcpCommunicationRecoveryAckClosureSelfTest<T extends Communic ClusterNode node0 = nodes.get(0); ClusterNode node1 = nodes.get(1); + // Await time to close the session by queue overflow. + final int awaitTime = 5_000; + + // Check that session will not be closed by idle timeout because expected close by queue overflow. + assertTrue(spi0.getIdleConnectionTimeout() > awaitTime); + final GridNioServer srv1 = U.field(spi1, "nioSrvr"); + // For prevent session close by write timeout. + srv1.writeTimeout(60_000); + final AtomicInteger ackMsgs = new AtomicInteger(0); IgniteInClosure<IgniteException> ackC = new CI1<IgniteException>() { @@ -317,14 +324,16 @@ public class IgniteTcpCommunicationRecoveryAckClosureSelfTest<T extends Communic // Send message to establish connection. spi0.sendMessage(node1, new GridTestMessage(node0.id(), ++msgId, 0), ackC); + int sentMsgs = 1; + // Prevent node1 from send GridTestUtils.setFieldValue(srv1, "skipWrite", true); final GridNioSession ses0 = communicationSession(spi0); - int sentMsgs = 1; + int queueLimit = ses0.outRecoveryDescriptor().queueLimit(); - for (int i = 0; i < 150; i++) { + for (int i = sentMsgs; i < queueLimit; i++) { try { spi0.sendMessage(node1, new GridTestMessage(node0.id(), ++msgId, 0), ackC); @@ -342,16 +351,19 @@ public class IgniteTcpCommunicationRecoveryAckClosureSelfTest<T extends Communic @Override public boolean apply() { return ses0.closeTime() != 0; } - }, 5000); + }, awaitTime); assertTrue("Failed to wait for session close", ses0.closeTime() != 0); GridTestUtils.setFieldValue(srv1, "skipWrite", false); - for (int i = 0; i < 100; i++) + // It to gain all acks since acks have batch nature. + int cnt = 100 - sentMsgs % spi0.getAckSendThreshold(); + + for (int i = 0; i < cnt; i++) spi0.sendMessage(node1, new GridTestMessage(node0.id(), ++msgId, 0), ackC); - final int expMsgs = sentMsgs + 100; + final int expMsgs = sentMsgs + cnt; final TestListener lsnr = (TestListener)spi1.getListener();
