From d676f1f70dfe453ba099cc930985c0bd42f66474 Mon Sep 17 00:00:00 2001 From: Seagulls Date: Sat, 31 Oct 2026 19:45:31 +0000 Subject: [PATCH] test(presets): hold async rebuild during no-wait assertion --- internal/presets/index_nowait_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/presets/index_nowait_test.go b/internal/presets/index_nowait_test.go index b9bc53c3..b4a864c7 100644 --- a/internal/presets/index_nowait_test.go +++ b/internal/presets/index_nowait_test.go @@ -114,9 +114,15 @@ New Game: if err := os.Chtimes(yamlPath, downloaded, downloaded); err != nil { t.Fatal(err) } + // Force the rebuild to remain in progress for this assertion. On a fast + // runner it can otherwise finish before the nonblocking read returns, + // which is valid production behaviour and makes this test intermittent. + release, builds := slowBuilds(t, sc) if got := sc.loadManifestIndexNoWait(); len(got) != 0 { t.Fatalf("got %+v, want nothing until the index is built", got) } + waitUntil(t, "the background rebuild to start", func() bool { return builds.Load() > 0 }) + release() deadline := time.Now().Add(30 * time.Second) for { if _, err := os.Stat(indexPath); err == nil {