Skip to content

Commit

Permalink
Client: add test for RSSI report after discovery failure
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidB137 committed Sep 24, 2024
1 parent cd9a3c5 commit 86dd78c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions test/tests/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,7 @@ TEST_CASE("Reporting of RSSI after gateway discovery", "[Client]")

std::this_thread::sleep_for(10ms);

// No publication should be made
// No report should be made
REQUIRE(ll.sentLog.size() == 2 + 2);
CHECK(ll.respSuccLog == RespSuccLog(2 + 2, true));
}
Expand All @@ -1382,7 +1382,6 @@ TEST_CASE("Reporting of RSSI after gateway discovery", "[Client]")
CHECK(cl.discoverGateway() == ErrCode::SUCCESS);

std::this_thread::sleep_for(10ms);

REQUIRE(ll.sentLog.size() == 2 + 2 + 1);
CHECK((ll.sentLog.back().pubs == correctReportPub ||
ll.sentLog.back().pubs == correctReportPubRev));
Expand All @@ -1397,10 +1396,20 @@ TEST_CASE("Reporting of RSSI after gateway discovery", "[Client]")
CHECK(cl.discoverGateway() == ErrCode::SUCCESS);

std::this_thread::sleep_for(10ms);

REQUIRE(ll.sentLog.size() == 2 + 2 + 1);
CHECK((ll.sentLog.back().pubs == correctReportPub ||
ll.sentLog.back().pubs == correctReportPubRev));
CHECK(ll.respSuccLog == RespSuccLog(2 + 2, true));
}

SECTION("Failure with RSSI")
{
CHECK(cl.discoverGateway() == ErrCode::TOO_MANY_FAILED_ATTEMPTS);

std::this_thread::sleep_for(10ms);

// No report should be made
REQUIRE(ll.sentLog.size() == 2 + 2);
CHECK(ll.respSuccLog == RespSuccLog(2, true));
}
}

0 comments on commit 86dd78c

Please sign in to comment.