From 84460e26963f0c6e421965c00ed2bb01467cab3d Mon Sep 17 00:00:00 2001 From: James Swan Date: Tue, 25 Feb 2025 21:30:15 +0000 Subject: [PATCH 1/2] fix(testing): Move CloseSession call after factory reset in TC_CGEN_2_8 The current implementation of commissioner.CloseSession only marks the session as defunct rather than fully closing it. This state can be reactivated if messages are exchanged on the session. By moving the CloseSession call to after the factory reset step, we ensure that the device session is already destroyed before marking it as defunct, preventing any possibility of message exchange that could reactivate the session. This allows the commissioner to successfully create a new session in subsequent steps. A follow-up change will be needed to properly fix the CloseSession function to use MarkForEviction instead of MarkAsDefunct, and potentially rename the current function to better reflect its behavior. --- src/python_testing/TC_CGEN_2_8.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/python_testing/TC_CGEN_2_8.py b/src/python_testing/TC_CGEN_2_8.py index 5e154cd15ee719..4a23545bc60a61 100644 --- a/src/python_testing/TC_CGEN_2_8.py +++ b/src/python_testing/TC_CGEN_2_8.py @@ -129,15 +129,15 @@ async def test_TC_CGEN_2_8(self): "First CommissioningComplete failed", ) - # Close the commissioner session with the device to clean up resources - commissioner.CloseSession(nodeid=self.dut_node_id) - # Step 5: Factory reset is handled by test operator self.step(5) if not self.check_pics('PICS_USER_PROMPT'): self.skip_all_remaining_steps(6) return + # Close the commissioner session with the device to clean up resources + commissioner.CloseSession(nodeid=self.dut_node_id) + self.wait_for_user_input(prompt_msg="Manually trigger factory reset on the DUT, then continue") # Step 6: Put device in commissioning mode (requiring user input, so skip in CI) From 627b9a4f9add4ba1803202ea4ad1aef863586fe7 Mon Sep 17 00:00:00 2001 From: James Swan Date: Wed, 26 Feb 2025 17:43:15 +0000 Subject: [PATCH 2/2] --- src/python_testing/TC_CGEN_2_8.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/python_testing/TC_CGEN_2_8.py b/src/python_testing/TC_CGEN_2_8.py index 4a23545bc60a61..99925eb6e2bc80 100644 --- a/src/python_testing/TC_CGEN_2_8.py +++ b/src/python_testing/TC_CGEN_2_8.py @@ -135,11 +135,11 @@ async def test_TC_CGEN_2_8(self): self.skip_all_remaining_steps(6) return + self.wait_for_user_input(prompt_msg="Manually trigger factory reset on the DUT, then continue") + # Close the commissioner session with the device to clean up resources commissioner.CloseSession(nodeid=self.dut_node_id) - self.wait_for_user_input(prompt_msg="Manually trigger factory reset on the DUT, then continue") - # Step 6: Put device in commissioning mode (requiring user input, so skip in CI) self.step(6) self.wait_for_user_input(prompt_msg="Manually set the DUT into commissioning mode, then continue")