Skip to content

Commit a7fe35a

Browse files
fix: use netstat over ss when testing unix socket (coder#16103)
Closes coder/internal#274. `TestSSH/RemoteForwardUnixSocket` previously used `ss` for confirming if a socket was listening. `ss` isn't available on macOS, causing the test to flake. The test previously passed on macOS as a 2 could always be read on the SSH connection, presumably reading it as part of some escape sequence? I confirmed the test passed on Linux if you comment out the `ss` command, the pty would always read a sequence ending in `[?2`.
1 parent 859abcd commit a7fe35a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

cli/ssh_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,9 +1146,8 @@ func TestSSH(t *testing.T) {
11461146
// started and accepting input on stdin.
11471147
_ = pty.Peek(ctx, 1)
11481148

1149-
// Download the test page
1150-
pty.WriteLine(fmt.Sprintf("ss -xl state listening src %s | wc -l", remoteSock))
1151-
pty.ExpectMatch("2")
1149+
pty.WriteLine(fmt.Sprintf("netstat -an | grep -q %s; echo \"returned $?\"", remoteSock))
1150+
pty.ExpectMatchContext(ctx, "returned 0")
11521151

11531152
// And we're done.
11541153
pty.WriteLine("exit")

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy