Skip to content

Commit 06a14c6

Browse files
committed
[tests] fix race condition in SRP recovery reboot test
Resolve a pre-existing race condition in dind_srp_tc_11.exp: - After the DUT reboots, the SRP server port changes. - The test was checking 'srp client host state' immediately and matching 'Registered' from the pre-reboot state, before the client actually detected the port change and re-registered. - Added a loop to wait for the client's registered server port to match the new server port before checking the host state.
1 parent 2871e36 commit 06a14c6

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

tests/scripts/expect/dind_srp_tc_11.exp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,30 @@ sleep 5
357357
# Since ED_1 is already configured, it should automatically detect the new port/SN and send an update.
358358
send_user "Step 14: Verifying ED_1 automatically re-registers...\n"
359359
switch_node 4
360+
if {[info exists port_after]} {
361+
set port_dec [expr 0x$port_after]
362+
send_user "Waiting for ED_1 to update SRP server port to $port_dec...\n"
363+
set port_matched false
364+
for {set j 0} {$j < 20} {incr j} {
365+
send "srp client server\n"
366+
expect {
367+
-re ".*:$port_dec" {
368+
set port_matched true
369+
break
370+
}
371+
-re "Done" {
372+
# Continue
373+
}
374+
timeout {
375+
# Continue
376+
}
377+
}
378+
sleep 2
379+
}
380+
if {!$port_matched} {
381+
fail "ED_1 did not update SRP server port to $port_dec"
382+
}
383+
}
360384
wait_for "srp client host state" "Registered"
361385
expect_line "Done"
362386

0 commit comments

Comments
 (0)