Skip to content

Commit 26d8c5c

Browse files
authored
Merge pull request #1318 from buildpacks/fix/ssh-dialer-timeout
Fix: wrong implementation of ssh dialer timeout in tests
2 parents 2ac66b7 + eb18598 commit 26d8c5c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

internal/sshdialer/ssh_dialer_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,12 +574,16 @@ func prepareSSHServer(t *testing.T) (connConfig *ConnectionConfig, cleanUp func(
574574
}
575575

576576
// wait for ssh container to start serving ssh
577+
// overall timeout before giving up on connecting
578+
timeout := time.After(20 * time.Second)
579+
// wait this amount between retries
580+
waitTicker := time.Tick(2 * time.Second)
577581
for {
578582
select {
579-
case <-time.After(time.Second * 20):
583+
case <-timeout:
580584
err = fmt.Errorf("test container failed to start serving ssh")
581585
return
582-
case <-time.After(time.Second * 2):
586+
case <-waitTicker:
583587
}
584588

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

0 commit comments

Comments
 (0)