Skip to content

Commit

Permalink
Merge pull request #1372 from openmeterio/fix/intermittent-test-faili…
Browse files Browse the repository at this point in the history
…ures

Fix concurrent map writes
  • Loading branch information
GAlexIHU authored Aug 15, 2024
2 parents 1dc1bf3 + c52b2b4 commit 66be7dd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions internal/productcatalog/adapter/feature_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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()
Expand Down

0 comments on commit 66be7dd

Please sign in to comment.