Skip to content

Commit

Permalink
tests: settings: delay after connection for log flush
Browse files Browse the repository at this point in the history
When registering settings during the HIL test, we get a flood
of log messages. On some platforms this can overwhelm the log
buffer and lead to dropped messages. If one of those dropped
messages is the connection message that the test scripts wait
for, the test will fail.

Now, we add a small delay after registering the settings to give
time for the log buffer to flush, and then send a new "settings
registration complete" message for the test script to key off of.
This ensures the test script receives the message, and
increases the stability of the test.

Signed-off-by: Sam Friedman <[email protected]>
  • Loading branch information
sam-golioth committed Jan 29, 2025
1 parent 88ff1db commit 9942283
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions tests/hil/tests/settings/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ void hil_test_entry(const struct golioth_client_config *config)

struct golioth_settings *settings = perform_settings_registration(client);

/* Allow log buffer to clear then notify test script of registration complete */

golioth_sys_msleep(5 * 1000);

GLTH_LOGI(TAG, "Settings registration complete");

while (1)
{
if (golioth_sys_sem_take(cancel_all_sem, 0))
Expand Down
4 changes: 2 additions & 2 deletions tests/hil/tests/settings/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ async def setup(project, board, device):
golioth_cred = (await device.credentials.list())[0]
await board.set_golioth_psk_credentials(golioth_cred.identity, golioth_cred.key)

# Confirm connection to Golioth
assert None != await board.wait_for_regex_in_line('Golioth CoAP client connected', timeout_s=120)
# Wait for settings registration
assert None != await board.wait_for_regex_in_line('Settings registration complete', timeout_s=30)

async def assert_settings_error(device, key, error):
await device.refresh()
Expand Down

0 comments on commit 9942283

Please sign in to comment.