From 0d30062546f57ebb662bac358093faf7b1c74fc6 Mon Sep 17 00:00:00 2001 From: Rolando Santamaria Maso <4096860+jkyberneees@users.noreply.github.com> Date: Sun, 18 Oct 2026 14:16:16 +0200 Subject: [PATCH] fix(test): race-aware sizing for two timing-sensitive tests TestRED_RedactCredentialNamesScaleLinearly applied its 1 MiB wall-clock budget under -race, and TestRED_RunsFinishedRunPinsAgentAndSession built a 6 MiB session under -race although its heap check is skipped there. Both failed the documented 'go test -race ./... -count=1' locally. Follow the existing raceEnabled pattern; non-race runs keep the full checks. Co-Authored-By: Claude Opus 5.5 --- cmd/odek/redhunt_2026_10_17_runs_test.go | 6 ++++-- internal/redact/redhunt_2026_10_12b_ops_test.go | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cmd/odek/redhunt_2026_10_17_runs_test.go b/cmd/odek/redhunt_2026_10_17_runs_test.go index 23fd82a4..5cd8ef98 100644 --- a/cmd/odek/redhunt_2026_10_17_runs_test.go +++ b/cmd/odek/redhunt_2026_10_17_runs_test.go @@ -105,8 +105,10 @@ func TestRED_RunsFinishedRunPinsAgentAndSession(t *testing.T) { t.Cleanup(resetServeRuns) // One large prior turn in the session (well under the 32 MiB file cap). + // The heap check below is skipped under -short and -race, so only it + // needs the large payload; under -race a 6 MiB turn outlives the run wait. payload := 6 << 20 - if testing.Short() { + if testing.Short() || raceEnabled { payload = 64 << 10 } sess, err := env.store.Create([]session.Message{ @@ -129,7 +131,7 @@ func TestRED_RunsFinishedRunPinsAgentAndSession(t *testing.T) { base := measure() runs := 4 - if testing.Short() { + if testing.Short() || raceEnabled { runs = 1 } var finished []*serveRun diff --git a/internal/redact/redhunt_2026_10_12b_ops_test.go b/internal/redact/redhunt_2026_10_12b_ops_test.go index 0139c855..4b7a823a 100644 --- a/internal/redact/redhunt_2026_10_12b_ops_test.go +++ b/internal/redact/redhunt_2026_10_12b_ops_test.go @@ -189,7 +189,8 @@ func TestRED_RedactCredentialNamesScaleLinearly(t *testing.T) { if large > 9*small { t.Errorf("%s: super-linear: 64KiB %v, 256KiB %v", name, small, large) } - if !testing.Short() && ops12bTime(gen(1<<20)) > 10*time.Second { + // Wall-clock budget only without the race detector (5-10x slower). + if !raceEnabled && !testing.Short() && ops12bTime(gen(1<<20)) > 10*time.Second { t.Errorf("%s: 1 MiB too slow", name) } }