mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
fix: wait for dial goroutine to complete (#10959)
Fixes flake seen here: https://github.com/coder/coder/runs/19170327767 The goroutine that attempts to dial the socket didn't complete before the test did. Here we add an explicit wait for it to complete in each run of the loop.
This commit is contained in:
@ -406,7 +406,9 @@ func TestSSH(t *testing.T) {
|
||||
//
|
||||
// To work around this, we attempt to send messages in a loop until one succeeds
|
||||
success := make(chan struct{})
|
||||
done := make(chan struct{})
|
||||
go func() {
|
||||
defer close(done)
|
||||
var (
|
||||
conn net.Conn
|
||||
err error
|
||||
@ -444,6 +446,8 @@ func TestSSH(t *testing.T) {
|
||||
fsn.Notify()
|
||||
<-cmdDone
|
||||
fsn.AssertStopped()
|
||||
// wait for dial goroutine to complete
|
||||
_ = testutil.RequireRecvCtx(ctx, t, done)
|
||||
|
||||
// wait for the remote socket to get cleaned up before retrying,
|
||||
// because cleaning up the socket happens asynchronously, and we
|
||||
|
Reference in New Issue
Block a user