Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions testutil/testutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ func AwaitCondition(cond util.Condition, period time.Duration, maxWait time.Dura
// run are ready.d
func WaitForPort(t *testing.T, port int) error {
err := AwaitCondition(func() bool {
conn, err := net.Dial("tcp", "localhost:"+strconv.Itoa(port))
if err != nil {
conn, _ := net.Dial("tcp", "localhost:"+strconv.Itoa(port))
if conn != nil {
conn.Close()
return true
}
return err != nil
return false
}, 500*time.Millisecond, 60*time.Second)
return err
}