From c52b2b4709611aa329f12b48202b8801bc5a1858 Mon Sep 17 00:00:00 2001 From: Alex Goth Date: Thu, 15 Aug 2024 11:58:31 +0200 Subject: [PATCH] fix: lock for all schema upserts --- internal/productcatalog/adapter/feature_test.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/productcatalog/adapter/feature_test.go b/internal/productcatalog/adapter/feature_test.go index b1db60727..287f98d1d 100644 --- a/internal/productcatalog/adapter/feature_test.go +++ b/internal/productcatalog/adapter/feature_test.go @@ -212,12 +212,12 @@ func TestCreateFeature(t *testing.T) { tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() - driver := testutils.InitPostgresDB(t) - dbClient := db.NewClient(db.Driver(driver)) - m.Lock() defer m.Unlock() + driver := testutils.InitPostgresDB(t) + dbClient := db.NewClient(db.Driver(driver)) + if err := dbClient.Schema.Create(context.Background()); err != nil { t.Fatalf("failed to migrate database %s", err) } @@ -231,6 +231,9 @@ func TestCreateFeature(t *testing.T) { t.Run("Should actually use the pg driver and write through that", func(t *testing.T) { t.Parallel() + m.Lock() + defer m.Unlock() + driver := testutils.InitPostgresDB(t) dbClient := db.NewClient(db.Driver(driver)) defer dbClient.Close()