From eb0cb09892cc457ebd8834296576db446d514045 Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Fri, 20 Nov 2026 07:19:20 +0000 Subject: [PATCH] test(inst): correct comment in TestInitializeInstanceDaoCaches Several go/inst test files call config.MarkConfigurationLoaded() in init(), so the background initializeInstanceDao() goroutine does run in unit tests. Follow-up to #135. --- go/inst/instance_dao_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/go/inst/instance_dao_test.go b/go/inst/instance_dao_test.go index 66853598..4874556f 100644 --- a/go/inst/instance_dao_test.go +++ b/go/inst/instance_dao_test.go @@ -148,9 +148,10 @@ func fmtArgs(args []interface{}) string { } func TestInitializeInstanceDaoCaches(t *testing.T) { - // The configuration is never marked loaded in unit tests, so the background - // initializeInstanceDao() goroutine never creates the caches; only the - // synchronous call can. + // The synchronous initializer must create the caches by itself, and calling it + // more than once must be harmless. (Other test files in this package mark the + // configuration as loaded, so the background initializeInstanceDao() goroutine + // may also run and call it concurrently; sync.Once makes that safe.) InitializeInstanceDaoCaches() InitializeInstanceDaoCaches() test.S(t).ExpectTrue(forgetInstanceKeys != nil)