Skip to content

Commit f9f733a

Browse files
committed
actions: Add board provisioning testing
Run provisioning tests on schedule. Signed-off-by: Jorgen Kvalvaag <[email protected]>
1 parent 55dd378 commit f9f733a

4 files changed

Lines changed: 10 additions & 15 deletions

File tree

.github/workflows/build-and-target-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
PUSH=${{ github.event_name == 'push' }}
3737
push_memory_badges=false
3838
if [[ $SCHEDULED == true ]]; then
39-
devices='["thingy91x","nrf9151dk","ppk_thingy91x","gnss_nrf9151dk"]'
39+
devices='["thingy91x","nrf9151dk","ppk_thingy91x","gnss_nrf9151dk", "prov_thingy91x"]'
4040
build_all=true
4141
push_memory_badges=true
4242
elif [[ $PUSH == true ]]; then

app/prj.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,3 +244,5 @@ CONFIG_NRF_PROVISIONING_RX_BUF_SZ=4096
244244
CONFIG_NRF_PROVISIONING_TX_BUF_SZ=4096
245245
CONFIG_NRF_PROVISIONING_CODEC_AT_CMD_LEN=2048
246246
CONFIG_NRF_PROVISIONING_CODEC_RX_SZ_START=2048
247+
248+
CONFIG_NRF_PROVISIONING_COAP_TIMEOUT_SECONDS=6

tests/on_target/tests/conftest.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
DEVICE_UUID = os.getenv('UUID')
2424
NRFCLOUD_API_KEY = os.getenv('NRFCLOUD_API_KEY')
2525
DUT_DEVICE_TYPE = os.getenv('DUT_DEVICE_TYPE')
26-
if DUT_DEVICE_TYPE == "ppk_thingy91x":
27-
DUT_DEVICE_TYPE = "thingy91x"
28-
2926

3027
def get_uarts():
3128
base_path = "/dev/serial/by-id"

tests/on_target/tests/test_provisioning/test_provisioning.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import sys
33
import json
4+
import pytest
45
import requests.exceptions # Used for handling HTTP errors from nRF Cloud API
56

67
# Ensure the utils directory is in the Python path
@@ -97,7 +98,7 @@ def _claim_device_on_nrf_cloud(dut_cloud, attestation_token: str):
9798
def _wait_for_provisioning_completion_and_cloud_connection(dut_cloud, timeout: int = 240):
9899
logger.info("Waiting for provisioning to complete and device to connect to nRF Cloud...")
99100

100-
dut_cloud.uart.wait_for_str("cloud: Provisioning finished", timeout=timeout)
101+
dut_cloud.uart.wait_for_str("cloud: nrf_provisioning_callback: Provisioning finished", timeout=timeout)
101102
dut_cloud.uart.wait_for_str("cloud: Connected to Cloud", timeout=timeout)
102103

103104
logger.info("Device provisioned and connected to nRF Cloud.")
@@ -220,8 +221,8 @@ def _run_reprovisioning_expecting_no_commands(dut_cloud):
220221
logger.info("--- Phase 3: Reprovisioning Expecting No Commands Completed Successfully ---")
221222

222223
# --- Main Test ---
223-
224-
def test_device_provisioning(dut_cloud, hex_file):
224+
@pytest.mark.parametrize("_", range(1,10))
225+
def test_device_provisioning(_, dut_cloud, hex_file):
225226
"""
226227
Tests the full device provisioning and reprovisioning lifecycle:
227228
1. Initial provisioning: Flashes, gets attestation token, claims on nRF Cloud, connects.
@@ -231,12 +232,7 @@ def test_device_provisioning(dut_cloud, hex_file):
231232
connects to nRF Cloud Provisioning Service, but finds no new commands to process and establishes
232233
a connection without reprovisioning.
233234
"""
235+
_run_initial_provisioning(dut_cloud, hex_file)
236+
_run_reprovisioning(dut_cloud)
237+
_run_reprovisioning_expecting_no_commands(dut_cloud)
234238

235-
for i in range(1, 21):
236-
logger.info(f"--- Starting Test Iteration: {i}/20 ---")
237-
_run_initial_provisioning(dut_cloud, hex_file)
238-
_run_reprovisioning(dut_cloud)
239-
_run_reprovisioning_expecting_no_commands(dut_cloud)
240-
logger.info(f"--- Completed Test Iteration: {i}/20 ---")
241-
242-
logger.info("Device provisioning and reprovisioning test completed successfully.")

0 commit comments

Comments
 (0)