Skip to content

Commit 799496c

Browse files
SeppoTakalobjarki-andreasen
authored andcommitted
[nrf fromlist] tests: lwm2m: Fix minor timing issues on tests
* Wait for update when new object is created Sometimes our blockwise transfer starts before server have received an LwM2M Update. This causes Leshan to reject the SEND because is was not aware of object /19/0 * Wait "registered" message already in conftest.py. Sometimes Qemu boots faster, and the testcase don't see the log. Upstream PR: zephyrproject-rtos/zephyr#79261 Signed-off-by: Seppo Takalo <[email protected]>
1 parent a669c8c commit 799496c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

tests/net/lib/lwm2m/interop/pytest/test_blockwise.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ def test_blockwise_3(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint:
7979
"""Blockwise test 3: Block-Wise Get using TLV and SenML-CBOR content formats"""
8080

8181
shell.exec_command('lwm2m create /19/0')
82+
# Wait for update to finish so server is aware of the /19/0 object
83+
dut.readlines_until(regex='.*net_lwm2m_rd_client: Update Done', timeout=5.0)
8284

8385
# Generate 4 kB of binary app-data
8486
# and write it into BinaryAppData object
@@ -109,6 +111,9 @@ def test_blockwise_4(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint:
109111
"""Blockwise test 4: Block-Wise SEND using SenML-CBOR content format"""
110112

111113
shell.exec_command('lwm2m create /19/0')
114+
# Wait for update to finish so server is aware of the /19/0 object
115+
dut.readlines_until(regex='.*net_lwm2m_rd_client: Update Done', timeout=5.0)
116+
112117
# Generate 4 kB of binary app-data
113118
data = ''.join(random.choice(string.ascii_letters) for i in range(4096)).encode()
114119
fmt = leshan.format

tests/net/lib/lwm2m/interop/pytest/test_nosec.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,8 @@
2626
def test_LightweightM2M_1_1_int_101(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint_nosec: str):
2727
"""
2828
Verify that the client is registered.
29-
Note that this MUST be the first testcase executed, otherwise it will fail to get the
30-
correct log output.
3129
"""
3230
logger.info("LightweightM2M-1.1-int-101 - Initial Registration")
33-
dut.readlines_until(regex='.*Registration Done', timeout=5.0)
3431
assert leshan.get(f'/clients/{endpoint_nosec}')
3532

3633
def test_LightweightM2M_1_1_int_105(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint_nosec: str, helperclient: object):

0 commit comments

Comments
 (0)