Skip to content

Commit

Permalink
test(action): add timeout to SSH server start
Browse files Browse the repository at this point in the history
Signed-off-by: AtomicFS <[email protected]>
  • Loading branch information
AtomicFS authored and MDr164 committed Dec 19, 2024
1 parent 5509437 commit 57ef276
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion action/container/ssh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"fmt"
"os"
"testing"
"time"

"dagger.io/dagger"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -110,7 +111,15 @@ func TestOpenSSH(t *testing.T) {
assert.NoError(t, err)
}()
// Wait until SSH server is ready
<-tc.optsSSH.TunnelReady
ticker := time.NewTicker(5 * time.Second)
select {
case <-tc.optsSSH.TunnelReady:
ticker.Stop()
case <-ticker.C:
ticker.Stop()
ctx.Done()
assert.FailNow(t, "timeout waiting for SSH server to be ready")
}

// Connect with client
config := &ssh.ClientConfig{
Expand Down

0 comments on commit 57ef276

Please sign in to comment.