diff --git a/pkg/metadata/gormstore/snapshots_test.go b/pkg/metadata/gormstore/snapshots_test.go index cb68f49..de584ad 100644 --- a/pkg/metadata/gormstore/snapshots_test.go +++ b/pkg/metadata/gormstore/snapshots_test.go @@ -196,6 +196,7 @@ func checkTrendWindow(t *testing.T, store *GORMStoreV2) { // attachCounter counts the statements of the store and of its worker, which holds its own handle. func attachCounter(store *GORMStoreV2) *dbcount.Counter { var counter *dbcount.Counter + store.aggregationWorker.Stop() // its handle is swapped below; a running loop would race store.WrapDB(func(db *gorm.DB) *gorm.DB { counted, c := dbcount.Attach(db) counter = c