From 4bfadcf0b799cd64ace3025b36d5e2ce72996ed1 Mon Sep 17 00:00:00 2001 From: Vegar Sechmann Molvig Date: Fri, 23 Oct 2026 12:33:28 +0200 Subject: [PATCH] test(device): use short socket path on macOS --- internal/naisdevice/command/gateway_test.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/internal/naisdevice/command/gateway_test.go b/internal/naisdevice/command/gateway_test.go index 6342526a..52e3c7ae 100644 --- a/internal/naisdevice/command/gateway_test.go +++ b/internal/naisdevice/command/gateway_test.go @@ -43,8 +43,14 @@ func TestGatewayDescribeChoices(t *testing.T) { if runtime.GOOS == "windows" { t.Skip("the fake agent uses a Unix socket") } - // Keep the socket path short enough for Unix socket limits, regardless of subtest names. - configDir := t.TempDir() + // Keep the socket path short enough for Unix socket limits (104 bytes on macOS). t.TempDir() lives + // under a long per-test directory on macOS and, combined with "Library/Application Support", + // overflows that limit, so use a short directory under /tmp instead. + configDir, err := os.MkdirTemp("/tmp", "nd") + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { _ = os.RemoveAll(configDir) }) t.Setenv("HOME", configDir) t.Setenv("XDG_CONFIG_HOME", configDir) agentDir, err := config.UserConfigDir()