unittests: Fix Test_LoRaWANStack.acquire_tx_metadata

This test was relying on the state of `LoRaMac_stub::bool_true_counter`
to be set to 1 from a previous test. When the test was ran in isolation
the `LoRaWANStack::rx_timeout_interrupt_handler` callback would fail
because we weren't returning true from the stub implementation of
`LoRaMac::nwk_joined`. Due to this
`LoRaWANStack::post_process_tx_no_reception` was never called. This
caused the LoRaWANStack object to think the "tx_metadata" was "stale"
(i.e the data hadn't changed since any previous read). So, when we
attempted to call `LoRaWANStack::acquire_tx_metadata` it returned
`LORAWAN_STATUS_METADATA_NOT_AVAILABLE` as it thought we had no new
metadata to report, causing the test assertion to fail.
pull/14944/head
Robert Walton 2021-07-26 21:52:05 +01:00
parent 9f3069f1e1
commit 421adc9888
1 changed files with 1 additions and 0 deletions

View File

@ -631,6 +631,7 @@ TEST_F(Test_LoRaWANStack, acquire_tx_metadata)
memset(&conf, 0, sizeof(conf));
conf.status = LORAMAC_EVENT_INFO_STATUS_OK;
LoRaMac_stub::mcps_conf_ptr = &conf;
LoRaMac_stub::bool_true_counter = 1;
radio._ev->tx_done();
LoRaMac_stub::slot_value = RX_SLOT_WIN_2;