@@ -138,8 +138,7 @@ def steps_TC_CCTRL_2_2(self) -> list[TestStep]:
138
138
TestStep (24 , "Reading Event CommissioningRequestResult from DUT, confirm one new event" ),
139
139
TestStep (25 , "Send CommissionNode command to DUT with CASE session, with valid parameters" ),
140
140
TestStep (26 , "Send OpenCommissioningWindow command on Administrator Commissioning Cluster sent to TH_SERVER" ),
141
- TestStep (27 , "Wait for DUT to successfully commission TH_SERVER, 30 seconds" ),
142
- TestStep (28 , "Get number of fabrics from TH_SERVER, verify DUT successfully commissioned TH_SERVER" )]
141
+ TestStep (27 , "Get number of fabrics from TH_SERVER, verify DUT successfully commissioned TH_SERVER (up to 30 seconds)" )]
143
142
144
143
return steps
145
144
@@ -317,15 +316,22 @@ async def test_TC_CCTRL_2_2(self):
317
316
await self .send_single_cmd (cmd , dev_ctrl = self .TH_server_controller , node_id = self .server_nodeid , endpoint = 0 , timedRequestTimeoutMs = 5000 )
318
317
319
318
self .step (27 )
320
- if not self .is_pics_sdk_ci_only :
321
- time .sleep (30 )
322
-
323
- self .step (28 )
324
- th_server_fabrics_new = await self .read_single_attribute_check_success (cluster = Clusters .OperationalCredentials , attribute = Clusters .OperationalCredentials .Attributes .Fabrics , dev_ctrl = self .TH_server_controller , node_id = self .server_nodeid , endpoint = 0 , fabric_filtered = False )
325
- # TODO: this should be mocked too.
326
- if not self .is_pics_sdk_ci_only :
327
- asserts .assert_equal (len (th_server_fabrics ) + 1 , len (th_server_fabrics_new ),
328
- "Unexpected number of fabrics on TH_SERVER" )
319
+ max_wait_time_sec = 30
320
+ start_time = time .time ()
321
+ elapsed = 0
322
+ time_remaining = max_wait_time_sec
323
+ previous_number_th_server_fabrics = len (th_server_fabrics_new )
324
+
325
+ while time_remaining > 0 :
326
+ time .sleep (2 )
327
+ th_server_fabrics_new = await self .read_single_attribute_check_success (cluster = Clusters .OperationalCredentials , attribute = Clusters .OperationalCredentials .Attributes .Fabrics , dev_ctrl = self .TH_server_controller , node_id = self .server_nodeid , endpoint = 0 , fabric_filtered = False )
328
+ if previous_number_th_server_fabrics != len (th_server_fabrics_new ):
329
+ break
330
+ elapsed = time .time () - start_time
331
+ time_remaining = max_wait_time_sec - elapsed
332
+
333
+ asserts .assert_equal (previous_number_th_server_fabrics + 1 , len (th_server_fabrics_new ),
334
+ "Unexpected number of fabrics on TH_SERVER" )
329
335
330
336
331
337
if __name__ == "__main__" :
0 commit comments