Skip to content

Commit

Permalink
Merge pull request #1318 from buildpacks/fix/ssh-dialer-timeout
Browse files Browse the repository at this point in the history
Fix: wrong implementation of ssh dialer timeout in tests
  • Loading branch information
jromero authored Nov 8, 2021
2 parents 2ac66b7 + eb18598 commit 26d8c5c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/sshdialer/ssh_dialer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,12 +574,16 @@ func prepareSSHServer(t *testing.T) (connConfig *ConnectionConfig, cleanUp func(
}

// wait for ssh container to start serving ssh
// overall timeout before giving up on connecting
timeout := time.After(20 * time.Second)
// wait this amount between retries
waitTicker := time.Tick(2 * time.Second)
for {
select {
case <-time.After(time.Second * 20):
case <-timeout:
err = fmt.Errorf("test container failed to start serving ssh")
return
case <-time.After(time.Second * 2):
case <-waitTicker:
}

t.Logf("connecting to ssh: %s:%d", connConfig.hostIPv4, connConfig.portIPv4)
Expand Down

0 comments on commit 26d8c5c

Please sign in to comment.