From f7cc09542c6592ff450cc81b2b722a704c96342f Mon Sep 17 00:00:00 2001 From: Dan Pupius Date: Mon, 27 Apr 2026 21:44:24 +0000 Subject: [PATCH] test(deps): skip transient failures in github URL reachability test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TestRegistryGithubBinaryURLsExist hits real GitHub release URLs to verify asset names. Transient 5xx responses and network errors were being reported as test failures, breaking CI on every GitHub blip (e.g. ripgrep arm64 502 on main, run 25020206997). Only fail on 404/410 (asset genuinely missing) and other 4xx (real config problems). Skip on 5xx and transport errors. Update the test comment to match actual behavior — it claimed to be opt-in via -urls, but only honored testing.Short. --- internal/deps/registry_test.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/internal/deps/registry_test.go b/internal/deps/registry_test.go index 0b545c61..cb065427 100644 --- a/internal/deps/registry_test.go +++ b/internal/deps/registry_test.go @@ -228,7 +228,9 @@ func TestRegistryGithubBinaryPlaceholders(t *testing.T) { // TestRegistryGithubBinaryURLsExist validates that all github-binary download URLs // are reachable. This catches version/asset naming errors before e2e tests. -// Skipped by default; run with: go test -run TestRegistryGithubBinaryURLsExist -urls +// Skipped in short mode. Transient network errors and 5xx responses skip the +// individual subtest rather than failing — only 404/410 (which indicate a +// genuinely wrong asset URL) are reported as failures. func TestRegistryGithubBinaryURLsExist(t *testing.T) { if testing.Short() { t.Skip("Skipping URL validation in short mode") @@ -270,13 +272,16 @@ func TestRegistryGithubBinaryURLsExist(t *testing.T) { resp, err := client.Do(req) if err != nil { - t.Fatalf("failed to reach %s: %v", url, err) + t.Skipf("transient network error reaching %s: %v", url, err) } defer resp.Body.Close() - if resp.StatusCode == http.StatusNotFound { - t.Errorf("URL returns 404: %s", url) - } else if resp.StatusCode >= 400 { + switch { + case resp.StatusCode == http.StatusNotFound, resp.StatusCode == http.StatusGone: + t.Errorf("URL returns %d (asset missing): %s", resp.StatusCode, url) + case resp.StatusCode >= 500: + t.Skipf("transient %d from %s", resp.StatusCode, url) + case resp.StatusCode >= 400: t.Errorf("URL returns %d: %s", resp.StatusCode, url) } })