[Test] [Rare] GridTcpCommunicationSpiRecoveryAckSelfTest and IgniteTcpCommunicationRecoveryAckClosureSelfTest
@@ -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();
