Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4a0b61e

Browse files
committed
make it more robust
1 parent fcb04be commit 4a0b61e

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

agent/agentssh/agentssh_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"strings"
1414
"sync"
1515
"testing"
16-
"time"
1716

1817
"github.com/prometheus/client_golang/prometheus"
1918
"github.com/spf13/afero"
@@ -193,10 +192,10 @@ func TestNewServer_CloseActiveConnections(t *testing.T) {
193192
}
194193
// The 60 seconds here is intended to be longer than the
195194
// test. The shutdown should propagate.
196-
err = sess.Start("/bin/bash -c 'trap \"sleep 60\" SIGTERM; sleep 60'")
195+
err = sess.Start("/bin/bash -c 'trap \"sleep 60\" SIGTERM; echo start\"ed\"; sleep 60'")
197196
assert.NoError(t, err)
198197

199-
time.Sleep(100 * time.Millisecond) // Give the session time to start.
198+
pty.ExpectMatchContext(ctx, "started")
200199
close(ch)
201200

202201
err = sess.Wait()

0 commit comments

Comments
 (0)