Skip to content

Commit

Permalink
Check that basic roundtrip write correctly sends all necessary acks. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Sep 1, 2021
1 parent 4a38f51 commit a7c24ca
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/app/tests/TestWriteInteraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ void TestWriteInteraction::TestWriteClient(nlTestSuite * apSuite, void * apConte
NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR);

writeClient.Shutdown();

Messaging::ReliableMessageMgr * rm = ctx.GetExchangeManager().GetReliableMessageMgr();
NL_TEST_ASSERT(apSuite, rm->TestGetCountRetransTable() == 0);
}

void TestWriteInteraction::TestWriteHandler(nlTestSuite * apSuite, void * apContext)
Expand Down Expand Up @@ -250,6 +253,9 @@ void TestWriteInteraction::TestWriteHandler(nlTestSuite * apSuite, void * apCont
NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR);

writeHandler.Shutdown();

Messaging::ReliableMessageMgr * rm = ctx.GetExchangeManager().GetReliableMessageMgr();
NL_TEST_ASSERT(apSuite, rm->TestGetCountRetransTable() == 0);
}

CHIP_ERROR WriteSingleClusterData(ClusterInfo & aClusterInfo, TLV::TLVReader & aReader, WriteHandler * aWriteHandler)
Expand Down Expand Up @@ -282,6 +288,10 @@ void TestWriteInteraction::TestWriteRoundtrip(nlTestSuite * apSuite, void * apCo

CHIP_ERROR err = CHIP_NO_ERROR;

Messaging::ReliableMessageMgr * rm = ctx.GetExchangeManager().GetReliableMessageMgr();
// Shouldn't have anything in the retransmit table when starting the test.
NL_TEST_ASSERT(apSuite, rm->TestGetCountRetransTable() == 0);

RoundtripDelegate delegate;
auto * engine = chip::app::InteractionModelEngine::GetInstance();
err = engine->Init(&ctx.GetExchangeManager(), &delegate);
Expand All @@ -302,6 +312,10 @@ void TestWriteInteraction::TestWriteRoundtrip(nlTestSuite * apSuite, void * apCo

NL_TEST_ASSERT(apSuite, delegate.mGotResponse);

// By now we should have closed all exchanges and sent all pending acks, so
// there should be no queued-up things in the retransmit table.
NL_TEST_ASSERT(apSuite, rm->TestGetCountRetransTable() == 0);

engine->Shutdown();
}

Expand Down

0 comments on commit a7c24ca

Please sign in to comment.