From f76f50c704550ca8af41b74642801034dc3071e9 Mon Sep 17 00:00:00 2001 From: William Mantly Date: Mon, 10 Aug 2026 19:11:38 -0400 Subject: [PATCH] fix(test): skip Linux-only hosts-file tests on non-Linux CI runners v2.1.2's release CI failed on the Windows build leg: TestApplyHostsOverride_* call applyHostsOverride(), which correctly refuses unconditionally on non-Linux (hosts_override.go) -- but the tests didn't account for `go test ./...` running on every platform the CI matrix builds for, only Linux. Skip them on non-Linux with a clear reason instead. --- hosts_override_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hosts_override_test.go b/hosts_override_test.go index a57678a..e7941e6 100644 --- a/hosts_override_test.go +++ b/hosts_override_test.go @@ -3,6 +3,7 @@ package main import ( "os" "path/filepath" + "runtime" "strings" "testing" @@ -11,6 +12,14 @@ import ( func withTempHostsFile(t *testing.T, initial string) string { t.Helper() + // applyHostsOverride refuses unconditionally on non-Linux (see + // hosts_override.go) -- these tests exercise the Linux write path + // specifically, so they'd fail for the right reason on the Windows CI + // runner if not skipped. Confirmed the hard way: a real CI run failed + // here after this was missed. + if runtime.GOOS != "linux" { + t.Skip("applyHostsOverride is Linux-only; skipping on " + runtime.GOOS) + } dir := t.TempDir() path := filepath.Join(dir, "hosts") if initial != "" {