Skip to content

Commit 8a7e33c

Browse files
swan-amazonnordicjm
authored andcommitted
[nrf fromtree] test: Close commissioner session to properly cleanup resources (#37523)
Add explicit CloseSession calls in TC_CGEN_2_8 and TC_CGEN_2_9 to ensure proper cleanup of commissioner library resources. This fixes an issue where subsequent commissioner sessions could not be established due to lingering resources from previous test runs. Bug: Commissioner session establishment failures in subsequent test runs Fix: Add explicit session cleanup after commissioning operations Testing: - Set PICS_USER_PROMPT=1 for manual intervention testing - Verified with terms-and-conditions-app test harness - Confirmed proper cleanup by: 1. Running initial commissioning 2. Performing factory reset (process kill + KVS cleanup) 3. Successfully re-establishing commissioner session - Test passes with manual intervention at factory reset and commissioning prompts (cherry picked from commit f654bba65a61620b50fa47b8149f302f7f78ff60) Signed-off-by: Adrian Gielniewski <[email protected]>
1 parent 82eea89 commit 8a7e33c

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/python_testing/TC_CGEN_2_8.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ async def test_TC_CGEN_2_8(self):
119119
"First CommissioningComplete failed",
120120
)
121121

122+
# Close the commissioner session with the device to clean up resources
123+
commissioner.CloseSession(nodeid=self.dut_node_id)
124+
122125
# Step 5: Factory reset is handled by test operator
123126
self.step(5)
124127
if not self.check_pics('PICS_USER_PROMPT'):

src/python_testing/TC_CGEN_2_9.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ async def test_TC_CGEN_2_9(self):
147147
self.step(5)
148148
await self.remove_commissioner_fabric()
149149

150+
# Close the commissioner session with the device to clean up resources
151+
commissioner.CloseSession(nodeid=self.dut_node_id)
152+
150153
# Step 6: Put device in commissioning mode (requiring user input, so skip in CI)
151154
self.step(6)
152155
if not self.check_pics('PICS_USER_PROMPT'):

0 commit comments

Comments
 (0)