Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Site
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software/vole.git

Self-hosted forge that lives in your Git repo.

Run and fix the test suite on macOS

30672859d26d65bc8a3075d6d075c1ac594eb924 · Keenan Nemetz · 7d ago · parent 6c694920

Run and fix the test suite on macOS

Run the unit suite on a Mac and fix the three platform bugs only runtime
execution can reveal:

- BSD wc -l pads its count, so a secret-log assertion that matched busybox
  output failed. Strip the padding in the step.
- os.UserCacheDir ignores XDG_CACHE_HOME on macOS, so the cache tests pointed
  at a directory the run never used. Override HOME and ask UserCacheDir.
- A Unix socket path in t.TempDir() exceeds macOS's 103-byte limit. Use a short
  nameless directory instead.

Add scripts/check-macos.sh, the one command a maintainer runs on a Mac before
signing off a macOS artifact, and document it in RELEASING.md.

internal/sshwire/sshwire_test.go +10−1

@@ -7,6 +7,7 @@ import (
7 7 "errors"
8 8 "io"
9 9 "net"
10 "os"
10 11 "path/filepath"
11 12 "strings"
12 13 "testing"
@@ -139,7 +140,15 @@ type fakeServer struct {
139 140 // serveOnce starts a Unix listener and answers one connection with fn.
140 141 func serveOnce(t *testing.T, fn func(*testing.T, net.Conn)) *fakeServer {
141 142 t.Helper()
142 s := &fakeServer{socket: filepath.Join(t.TempDir(), "ssh.sock"), got: make(chan Hello, 1)}
143 // macOS caps a Unix socket path at 103 bytes, and t.TempDir names the
144 // directory after the test, which can already be past the limit. A short,
145 // nameless directory keeps the socket bindable on every platform.
146 dir, err := os.MkdirTemp("", "sshwire-")
147 if err != nil {
148 t.Fatal(err)
149 }
150 t.Cleanup(func() { os.RemoveAll(dir) })
151 s := &fakeServer{socket: filepath.Join(dir, "ssh.sock"), got: make(chan Hello, 1)}
143 152 ln, err := net.Listen("unix", s.socket)
144 153 if err != nil {
145 154 t.Fatalf("listen: %v", err)