From 2e9672227dd217246d62796099bcf003d955c1ed Mon Sep 17 00:00:00 2001 From: Samuel K Date: Mon, 9 Nov 2026 21:45:05 -0600 Subject: [PATCH] fix(ci): allow three provider update test attempts --- hack/provider_update_ci/main_test.go | 56 +++++++++++++++++++--------- hack/provider_update_ci/retry.go | 4 +- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/hack/provider_update_ci/main_test.go b/hack/provider_update_ci/main_test.go index a5ae94ddc2..abbccaaea4 100644 --- a/hack/provider_update_ci/main_test.go +++ b/hack/provider_update_ci/main_test.go @@ -15,19 +15,20 @@ import ( ) const ( - fakeModeEnv = "DEVSY_PROVIDER_UPDATE_CI_FAKE_MODE" - cliModeEnv = "DEVSY_PROVIDER_UPDATE_CI_RUN_CLI" - fakeExitEnv = "DEVSY_PROVIDER_UPDATE_CI_FAKE_EXIT" - attemptsEnv = "DEVSY_PROVIDER_UPDATE_CI_ATTEMPTS_FILE" - largeLineEnv = "DEVSY_PROVIDER_UPDATE_CI_LARGE_LINE" - fakeGoBasename = "go" - missingMode = "missing" - skipMode = "skip" - noPassMode = "no-pass" - multipleMode = "multiple" - crashOnceMode = "crash-once" - crashTwiceMode = "crash-twice" - crashFailMode = "crash-after-failure" + fakeModeEnv = "DEVSY_PROVIDER_UPDATE_CI_FAKE_MODE" + cliModeEnv = "DEVSY_PROVIDER_UPDATE_CI_RUN_CLI" + fakeExitEnv = "DEVSY_PROVIDER_UPDATE_CI_FAKE_EXIT" + attemptsEnv = "DEVSY_PROVIDER_UPDATE_CI_ATTEMPTS_FILE" + largeLineEnv = "DEVSY_PROVIDER_UPDATE_CI_LARGE_LINE" + fakeGoBasename = "go" + missingMode = "missing" + skipMode = "skip" + noPassMode = "no-pass" + multipleMode = "multiple" + crashOnceMode = "crash-once" + crashTwiceMode = "crash-twice" + crashThriceMode = "crash-thrice" + crashFailMode = "crash-after-failure" ) var fixtureTests = []testID{ @@ -49,7 +50,12 @@ var fakeCaseExceptions = map[string]map[int][]string{ }, } -var fakeCrashCounts = map[string]int{crashOnceMode: 1, crashTwiceMode: 2, crashFailMode: 1} +var fakeCrashCounts = map[string]int{ + crashOnceMode: 1, + crashTwiceMode: 2, + crashThriceMode: 3, + crashFailMode: 1, +} func TestMain(m *testing.M) { if isFakeGoInvocation(os.Args[0]) { @@ -358,19 +364,33 @@ func TestCLIRetriesRuntimeCrashOnce(t *testing.T) { if got := countAttempts(t, attempts); got != 2 { t.Fatalf("attempts = %d, want 2", got) } - if !strings.Contains(stderr, "::warning::") || !strings.Contains(stderr, "attempt 2 of 2") { + if !strings.Contains(stderr, "::warning::") || !strings.Contains(stderr, "attempt 2 of 3") { t.Fatalf("retry warning missing: %q", stderr) } } -func TestCLIFailsWhenRuntimeCrashRepeats(t *testing.T) { +func TestCLIRetriesTwoRuntimeCrashes(t *testing.T) { attempts := setUpFakeGoWithAttempts(t, crashTwiceMode, "0") + _, stderr, code := runCLIProcess(t, "--artifacts-dir", t.TempDir()) + if code != 0 { + t.Fatalf("CLI failed after two recoverable crashes: %q", stderr) + } + if got := countAttempts(t, attempts); got != 3 { + t.Fatalf("attempts = %d, want 3", got) + } + if !strings.Contains(stderr, "attempt 3 of 3") { + t.Fatalf("retry warning missing: %q", stderr) + } +} + +func TestCLIFailsWhenRuntimeCrashRepeats(t *testing.T) { + attempts := setUpFakeGoWithAttempts(t, crashThriceMode, "0") _, _, code := runCLIProcess(t, "--artifacts-dir", t.TempDir()) if code != 2 { t.Fatalf("CLI exit code = %d, want 2", code) } - if got := countAttempts(t, attempts); got != 2 { - t.Fatalf("attempts = %d, want 2", got) + if got := countAttempts(t, attempts); got != 3 { + t.Fatalf("attempts = %d, want 3", got) } } diff --git a/hack/provider_update_ci/retry.go b/hack/provider_update_ci/retry.go index 9e73737d0b..49f78b8d9c 100644 --- a/hack/provider_update_ci/retry.go +++ b/hack/provider_update_ci/retry.go @@ -6,7 +6,7 @@ import ( ) const ( - maxTestAttempts = 2 + maxTestAttempts = 3 windowsAccessViolated = 0xc0000005 ) @@ -19,7 +19,7 @@ var runtimeFatalPrefixes = []string{ "panic: (interface {}) 0x", } -// runGoTestsWithRetry reruns the tests once when the Go runtime itself crashed. +// runGoTestsWithRetry reruns the tests up to twice when the Go runtime itself crashed. // Windows/amd64 AMX runners corrupt the heap when an exception frame overflows // the goroutine stack reserve (golang/go#81238, unfixed). Remove this retry once // a released Go toolchain contains the upstream fix.