From a2ef4242e746d9cd381bc5321d4abca8d4ff90ca Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Fri, 23 Jul 2021 10:04:55 -0700 Subject: [PATCH] fix test --- src/messaging/tests/TestReliableMessageProtocol.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/messaging/tests/TestReliableMessageProtocol.cpp b/src/messaging/tests/TestReliableMessageProtocol.cpp index 61557eb4fba2d1..56dee18c697226 100644 --- a/src/messaging/tests/TestReliableMessageProtocol.cpp +++ b/src/messaging/tests/TestReliableMessageProtocol.cpp @@ -445,6 +445,11 @@ void CheckUnencryptedMessageReceiveFailure(nlTestSuite * inSuite, void * inConte ExchangeContext * exchange = ctx.NewExchangeToPeer(&mockSender); NL_TEST_ASSERT(inSuite, exchange != nullptr); + ReliableMessageMgr * rm = ctx.GetExchangeManager().GetReliableMessageMgr(); + ReliableMessageContext * rc = exchange->GetReliableMessageContext(); + NL_TEST_ASSERT(inSuite, rm != nullptr); + NL_TEST_ASSERT(inSuite, rc != nullptr); + err = mockSender.mMessageDispatch.Init(); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); @@ -460,6 +465,9 @@ void CheckUnencryptedMessageReceiveFailure(nlTestSuite * inSuite, void * inConte // Test that the message was dropped by the receiver NL_TEST_ASSERT(inSuite, !mockReceiver.IsOnMessageReceivedCalled); + // Since peer dropped the message, we might have pending acks. Let's clear the table + rm->ClearRetransTable(rc); + exchange->Close(); }