Skip to content

test: fix TestWatcher_SharedParentRefcount on macOS#25379

Merged
ethanndickson merged 1 commit into
mainfrom
ci-flakes-ezy7
May 15, 2026
Merged

test: fix TestWatcher_SharedParentRefcount on macOS#25379
ethanndickson merged 1 commit into
mainfrom
ci-flakes-ezy7

Conversation

@ethanndickson
Copy link
Copy Markdown
Member

@ethanndickson ethanndickson commented May 15, 2026

TestWatcher_SharedParentRefcount was deterministically broken on macOS: t.TempDir() lives under /var which is a symlink to /private/var, but the watcher canonicalizes paths via filepath.EvalSymlinks before storing them, so the test's w.dirs[dir] lookup missed and returned 0 instead of 2.

Adds testutil.TempDirResolved, a shared helper that returns t.TempDir() with symlinks resolved and falls back to the raw temp dir on error (Windows-friendly). Migrates the matching inline EvalSymlinks(t.TempDir()) callsites in agent/agentgit/agentgit_test.go to use it.

Closes coder/internal#1531

@ethanndickson ethanndickson changed the title test(agent/x/agentmcp): resolve symlinks in TempDir for shared parent refcount test test: fix TestWatcher_SharedParentRefcount on macOS May 15, 2026
@ethanndickson ethanndickson marked this pull request as ready for review May 15, 2026 06:28
On macOS, t.TempDir() lives under /var which is a symlink to /private/var. The watcher canonicalizes paths via filepath.EvalSymlinks before storing them in w.dirs, so the assertion w.dirs[dir] returned 0 instead of the expected 2 on macOS runners.

Introduce testutil.TempDirResolved as a shared helper that returns t.TempDir() with symlinks resolved, falling back to the raw temp dir if EvalSymlinks errors (e.g. on Windows). Migrate the matching inline EvalSymlinks(t.TempDir()) callsites in agent/agentgit/agentgit_test.go to use it.

Closes coder/internal#1531
@ethanndickson ethanndickson merged commit 5e701d3 into main May 15, 2026
30 checks passed
@ethanndickson ethanndickson deleted the ci-flakes-ezy7 branch May 15, 2026 07:37
@github-actions github-actions Bot locked and limited conversation to collaborators May 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flake: Test process crash - TestWatcher_SharedParentRefcount timeout

2 participants