Skip to content

Commit 6337577

Browse files
authored
p2p/discover: wait for bootstrap to be done (#32881)
This ensures the node is ready to accept other nodes into the table before it is used in a test. Closes #32863
1 parent b28241b commit 6337577

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

p2p/discover/v4_udp_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,13 @@ func startLocalhostV4(t *testing.T, cfg Config) *UDPv4 {
575575
if err != nil {
576576
t.Fatal(err)
577577
}
578+
579+
// Wait for bootstrap to complete.
580+
select {
581+
case <-udp.tab.initDone:
582+
case <-time.After(5 * time.Second):
583+
t.Fatalf("timed out waiting for table initialization")
584+
}
578585
return udp
579586
}
580587

0 commit comments

Comments
 (0)