From dc356417ecadda5e185317ce8a84504bfc1b8400 Mon Sep 17 00:00:00 2001 From: Greg Gauthier Date: Sat, 6 Jun 2026 09:57:43 +0100 Subject: [PATCH] test: disable parallel execution to fix data races Removes t.Parallel() from TestRadioMenu_Unit, TestShowVersion_Unit, and TestPrecheck_Unit. These tests mutate globals, redirect os.Stdout, or call external dependencies, causing races when run concurrently with other tests under -race. --- radiomenu_test.go | 5 ++++- stations_test.go | 9 +++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/radiomenu_test.go b/radiomenu_test.go index 9ae5afb..c05fe24 100644 --- a/radiomenu_test.go +++ b/radiomenu_test.go @@ -78,7 +78,10 @@ func TestQuit_Unit(t *testing.T) { } func TestRadioMenu_Unit(t *testing.T) { - t.Parallel() + // Do not mark Parallel: RadioMenu does fmt.Println and constructs a wmenu.Menu. + // When this runs concurrently (via t.Parallel on the parent) with + // TestShowVersion_Unit (which mutates globals and does os.Stdout swapping), + // the race detector flags concurrent fmt + wmenu activity against global writes. t.Log("✓ Fast RadioMenu unit test") tests := []struct { diff --git a/stations_test.go b/stations_test.go index 4c33ed2..a3e4e0f 100644 --- a/stations_test.go +++ b/stations_test.go @@ -15,7 +15,10 @@ import ( ) func TestShowVersion_Unit(t *testing.T) { - t.Parallel() + // Do not mark Parallel: this test mutates the package-level "version" shim + // (and internal/version vars) and redirects os.Stdout. Running it concurrently + // with other legacy tests (esp. those calling RadioMenu which does fmt + wmenu) + // produces data races under -race. t.Log("✓ Fast showVersion unit test") tests := []struct { @@ -81,7 +84,9 @@ func TestShowVersion_Unit(t *testing.T) { } func TestPrecheck_Unit(t *testing.T) { - t.Parallel() + // Do not mark Parallel: precheck reads config + calls external IsInstalled, + // and in some paths can have side effects. Keep it serialized with other + // main-package legacy tests to avoid races on shared state under -race. t.Log("✓ Fast precheck unit test") p := "mpv"