Skip to content

Commit

Permalink
[Fix] Fix TestReadInteraction implementation
Browse files Browse the repository at this point in the history
Remove leftover debug printf.
Drain and service IO repeatedly until condition met.

Signed-off-by: ATmobica <artur.tynecki@mobica.com>
  • Loading branch information
ATmobica committed Oct 14, 2022
1 parent f76730a commit 41f379c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/app/tests/TestReadInteraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1565,8 +1565,6 @@ void TestReadInteraction::TestSubscribeRoundtrip(nlTestSuite * apSuite, void * a
delegate.mGotEventResponse = false;
delegate.mNumAttributeResponse = 0;

printf("HereHere\n");

err = engine->GetReportingEngine().SetDirty(dirtyPath1);
NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR);
err = engine->GetReportingEngine().SetDirty(dirtyPath2);
Expand Down Expand Up @@ -1840,13 +1838,16 @@ void TestReadInteraction::TestSubscribeWildcard(nlTestSuite * apSuite, void * ap
err = engine->GetReportingEngine().SetDirty(dirtyPath);
NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR);

ctx.DrainAndServiceIO();

//
// Not sure why I had to add this, and didn't have cycles to figure out why.
// Tracked in Issue #17528.
// We need to DrainAndServiceIO() until attribute callback will be called.
// This is not correct behavior and is tracked in Issue #17528.
//
ctx.DrainAndServiceIO();
int last;
do
{
last = delegate.mNumAttributeResponse;
ctx.DrainAndServiceIO();
} while (last != delegate.mNumAttributeResponse);

NL_TEST_ASSERT(apSuite, delegate.mGotReport);
// Mock endpoint3 has 13 attributes in total, and we subscribed twice.
Expand Down

0 comments on commit 41f379c

Please sign in to comment.