From 023aee775c6519e1363a75a496a46db593a37eba Mon Sep 17 00:00:00 2001 From: Patrik Date: Tue, 12 Jul 2022 16:43:14 +0200 Subject: [PATCH] test: `(*Connection).Create` in parallel --- executors_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/executors_test.go b/executors_test.go index d96f25062..3c685a84c 100644 --- a/executors_test.go +++ b/executors_test.go @@ -1,6 +1,7 @@ package pop import ( + "fmt" "testing" "time" @@ -533,6 +534,21 @@ func Test_Create_Non_PK_ID(t *testing.T) { }) } +func Test_Create_Parallel(t *testing.T) { + if PDB == nil { + t.Skip("skipping integration tests") + } + transaction(func(tx *Connection) { + for i := 0; i < 50; i++ { + i := i + t.Run(fmt.Sprintf("case=%d", i), func(t *testing.T) { + t.Parallel() + require.NoError(t, tx.Create(&User{Name: nulls.NewString(fmt.Sprintf("User %d", i))})) + }) + } + }) +} + func Test_Embedded_Struct(t *testing.T) { if PDB == nil { t.Skip("skipping integration tests")