Skip to content

test(agent/agentssh): fix test race and improve Windows compat #17271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 7, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
e tu window?
  • Loading branch information
mafredri committed Apr 7, 2025
commit ea5ab423aece3cfef9adb1b10f08e5738e8c4cec
7 changes: 6 additions & 1 deletion agent/agentssh/agentssh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,12 @@ func TestNewServer_CloseActiveConnections(t *testing.T) {
}
// The 60 seconds here is intended to be longer than the
// test. The shutdown should propagate.
err = sess.Start("/bin/bash -c 'trap \"sleep 60\" SIGTERM; echo start\"ed\"; sleep 60'")
if runtime.GOOS == "windows" {
// Best effort to at least partially test this in Windows.
err = sess.Start("echo start\"ed\" && sleep 60")
} else {
err = sess.Start("/bin/bash -c 'trap \"sleep 60\" SIGTERM; echo start\"ed\"; sleep 60'")
}
assert.NoError(t, err)

pty.ExpectMatchContext(ctx, "started")
Expand Down
Loading