Skip to content

Commit 94a47ad

Browse files
authored
test: Close commissioner session to properly cleanup resources (project-chip#37522)
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
1 parent 9d99ef2 commit 94a47ad

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/python_testing/TC_CGEN_2_8.py

+3
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ async def test_TC_CGEN_2_8(self):
131131
"First CommissioningComplete failed",
132132
)
133133

134+
# Close the commissioner session with the device to clean up resources
135+
commissioner.CloseSession(nodeid=self.dut_node_id)
136+
134137
# Step 5: Factory reset is handled by test operator
135138
self.step(5)
136139
if not self.check_pics('PICS_USER_PROMPT'):

src/python_testing/TC_CGEN_2_9.py

+3
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ async def test_TC_CGEN_2_9(self):
159159
self.step(5)
160160
await self.remove_commissioner_fabric()
161161

162+
# Close the commissioner session with the device to clean up resources
163+
commissioner.CloseSession(nodeid=self.dut_node_id)
164+
162165
# Step 6: Put device in commissioning mode (requiring user input, so skip in CI)
163166
self.step(6)
164167
if not self.check_pics('PICS_USER_PROMPT'):

0 commit comments

Comments
 (0)