From 54d8d139ad5b8fb053753d20a4471de2a7220e28 Mon Sep 17 00:00:00 2001 From: mesh-tools Date: Tue, 20 Oct 2026 23:24:37 +0000 Subject: [PATCH] Record the asked builds under a lock in the merge tests' helper, which the merge window's goroutine and the test call at once (issue 1543) --- cmd/mesh-controller/new_module_on_merge_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/mesh-controller/new_module_on_merge_test.go b/cmd/mesh-controller/new_module_on_merge_test.go index a022c869..9dc955ea 100644 --- a/cmd/mesh-controller/new_module_on_merge_test.go +++ b/cmd/mesh-controller/new_module_on_merge_test.go @@ -4,6 +4,7 @@ package main import ( "context" + "sync" "testing" "git.novox.be/novox/mesh-sdk/go/catalogue" @@ -11,12 +12,16 @@ import ( "github.com/novox/mesh-controller/internal/link" ) -// asksWithPaths records every build a merge asks for, as repository, path and ref. +// asksWithPaths records every build a merge asks for, as repository, path and ref. The merge window's goroutine and +// the test's own may ask at once, so the record is written under a lock (issue 1543). func asksWithPaths(t *testing.T) *[][3]string { t.Helper() var asked [][3]string + var mu sync.Mutex was := askABuild askABuild = func(_ context.Context, source buildSource, path, ref string) (string, error) { + mu.Lock() + defer mu.Unlock() asked = append(asked, [3]string{source.Repository, path, ref}) return "b-" + path, nil }