Skip to content

Commit

Permalink
test: (*Connection).Create in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
zepatrik committed Jul 12, 2022
1 parent 3f8518a commit 023aee7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions executors_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package pop

import (
"fmt"
"testing"
"time"

Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 023aee7

Please sign in to comment.