Skip to content

Commit

Permalink
ssh/test: skip tests on darwin that fail on the darwin-amd64-longtest…
Browse files Browse the repository at this point in the history
… LUCI builder

We don't yet understand why these tests fail, but the Apple sshd seems
to have some non-trivial vendor patches, so it is plausibly a
platform-specific bug in the test. Let's skip that failure mode on the
whole platform until/unless someone has time to reproduce and
investigate the failure.

For golang/go#64959.

Cq-Include-Trybots: luci.golang.try:x_crypto-gotip-darwin-amd64-longtest,x_crypto-gotip-linux-amd64-longtest,x_crypto-gotip-windows-amd64-longtest
Change-Id: I9e43579469de3fe9329c093b5916bbed0edd3751
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/554077
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Nicola Murino <nicola.murino@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
  • Loading branch information
Bryan C. Mills authored and gopherbot committed Jan 8, 2024
1 parent 403f699 commit dbb6ec1
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions ssh/test/agent_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func TestAgentForward(t *testing.T) {

sess, err := conn.NewSession()
if err != nil {
skipIfIssue64959(t, err)
t.Fatalf("NewSession: %v", err)
}
if err := agent.RequestAgentForwarding(sess); err != nil {
Expand Down
1 change: 1 addition & 0 deletions ssh/test/dial_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func testDial(t *testing.T, n, listenAddr string, x dialTester) {
// on the opened connection.
cancel()
if err != nil {
skipIfIssue64959(t, err)
t.Fatalf("Dial: %v", err)
}
x.TestClientConn(t, conn)
Expand Down
10 changes: 10 additions & 0 deletions ssh/test/forward_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"io"
"math/rand"
"net"
"runtime"
"testing"
"time"
)
Expand All @@ -27,6 +28,9 @@ func testPortForward(t *testing.T, n, listenAddr string) {

sshListener, err := conn.Listen(n, listenAddr)
if err != nil {
if runtime.GOOS == "darwin" && err == io.EOF {
t.Skipf("skipping test broken on some versions of macOS; see https://go.dev/issue/64959")
}
t.Fatal(err)
}

Expand Down Expand Up @@ -122,6 +126,9 @@ func testAcceptClose(t *testing.T, n, listenAddr string) {

sshListener, err := conn.Listen(n, listenAddr)
if err != nil {
if runtime.GOOS == "darwin" && err == io.EOF {
t.Skipf("skipping test broken on some versions of macOS; see https://go.dev/issue/64959")
}
t.Fatal(err)
}

Expand Down Expand Up @@ -163,6 +170,9 @@ func testPortForwardConnectionClose(t *testing.T, n, listenAddr string) {

sshListener, err := client.Listen(n, listenAddr)
if err != nil {
if runtime.GOOS == "darwin" && err == io.EOF {
t.Skipf("skipping test broken on some versions of macOS; see https://go.dev/issue/64959")
}
t.Fatal(err)
}

Expand Down
17 changes: 17 additions & 0 deletions ssh/test/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,21 @@ import (
"golang.org/x/crypto/ssh"
)

func skipIfIssue64959(t *testing.T, err error) {
if err != nil && runtime.GOOS == "darwin" && strings.Contains(err.Error(), "ssh: unexpected packet in response to channel open: <nil>") {
t.Helper()
t.Skipf("skipping test broken on some versions of macOS; see https://go.dev/issue/64959")
}
}

func TestRunCommandSuccess(t *testing.T) {
server := newServer(t)
conn := server.Dial(clientConfig())
defer conn.Close()

session, err := conn.NewSession()
if err != nil {
skipIfIssue64959(t, err)
t.Fatalf("session failed: %v", err)
}
defer session.Close()
Expand Down Expand Up @@ -66,6 +74,7 @@ func TestRunCommandStdin(t *testing.T) {

session, err := conn.NewSession()
if err != nil {
skipIfIssue64959(t, err)
t.Fatalf("session failed: %v", err)
}
defer session.Close()
Expand All @@ -88,6 +97,7 @@ func TestRunCommandStdinError(t *testing.T) {

session, err := conn.NewSession()
if err != nil {
skipIfIssue64959(t, err)
t.Fatalf("session failed: %v", err)
}
defer session.Close()
Expand All @@ -111,6 +121,7 @@ func TestRunCommandFailed(t *testing.T) {

session, err := conn.NewSession()
if err != nil {
skipIfIssue64959(t, err)
t.Fatalf("session failed: %v", err)
}
defer session.Close()
Expand All @@ -127,6 +138,7 @@ func TestRunCommandWeClosed(t *testing.T) {

session, err := conn.NewSession()
if err != nil {
skipIfIssue64959(t, err)
t.Fatalf("session failed: %v", err)
}
err = session.Shell()
Expand All @@ -146,6 +158,7 @@ func TestFuncLargeRead(t *testing.T) {

session, err := conn.NewSession()
if err != nil {
skipIfIssue64959(t, err)
t.Fatalf("unable to create new session: %s", err)
}

Expand Down Expand Up @@ -182,6 +195,7 @@ func TestKeyChange(t *testing.T) {
for i := 0; i < 4; i++ {
session, err := conn.NewSession()
if err != nil {
skipIfIssue64959(t, err)
t.Fatalf("unable to create new session: %s", err)
}

Expand Down Expand Up @@ -223,6 +237,7 @@ func TestValidTerminalMode(t *testing.T) {

session, err := conn.NewSession()
if err != nil {
skipIfIssue64959(t, err)
t.Fatalf("session failed: %v", err)
}
defer session.Close()
Expand Down Expand Up @@ -287,6 +302,7 @@ func TestWindowChange(t *testing.T) {

session, err := conn.NewSession()
if err != nil {
skipIfIssue64959(t, err)
t.Fatalf("session failed: %v", err)
}
defer session.Close()
Expand Down Expand Up @@ -349,6 +365,7 @@ func testOneCipher(t *testing.T, cipher string, cipherOrder []string) {
// Exercise receiving data from the server
session, err := conn.NewSession()
if err != nil {
skipIfIssue64959(t, err)
t.Fatalf("NewSession: %v", err)
}

Expand Down

0 comments on commit dbb6ec1

Please sign in to comment.