From e8df681d9b46ea55954ff6c8302e189403104eb9 Mon Sep 17 00:00:00 2001 From: Sycun <165354365+Sycun@users.noreply.github.com> Date: Thu, 8 Oct 2026 16:18:21 +0800 Subject: [PATCH] test: keep the scripted-toolchain scenarios off windows The four retry scenarios are driven through a scripted `go` (a POSIX shell script placed first on PATH) and a PATH with a symlinked git. On Windows neither harness resolves: the file would not be found through LookPath and would not execute, and the symlink needs privileges - the tests would either fail or silently assert nothing. They now skip there with the reason named, instead of reporting a platform they cannot speak for. `GOOS=windows go vet ./internal/update` compiles clean; macOS runs them for real. --- internal/update/pending_build_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/internal/update/pending_build_test.go b/internal/update/pending_build_test.go index 32dbe5f6..da78367a 100644 --- a/internal/update/pending_build_test.go +++ b/internal/update/pending_build_test.go @@ -5,6 +5,7 @@ import ( "os" "os/exec" "path/filepath" + "runtime" "strings" "testing" ) @@ -20,6 +21,12 @@ type fakeGo struct { func scriptFakeGo(t *testing.T) *fakeGo { t.Helper() + if runtime.GOOS == "windows" { + // The scripted toolchain is a POSIX shell script: Windows would not execute it, + // LookPath would not even find it, and the scenario would silently assert + // nothing. Driving it there needs a different harness, not a different promise. + t.Skip("the scripted go toolchain needs a POSIX shell") + } dir := t.TempDir() marker := filepath.Join(dir, "fail-build") f := &fakeGo{marker: marker} @@ -58,6 +65,11 @@ func (f *fakeGo) succeed(t *testing.T) { // (git) reachable: a directory holding a symlink to the real git and nothing else. func hideToolchain(t *testing.T) { t.Helper() + if runtime.GOOS == "windows" { + // Same reason as scriptFakeGo: symlinks need privileges there and the bare-name + // file would not resolve through LookPath. + t.Skip("PATH surgery here needs POSIX symlinks") + } realGit, err := exec.LookPath("git") if err != nil { t.Skip("git not installed")