(b *testing.B)
| 47 | } |
| 48 | |
| 49 | func BenchmarkDatabase_FsyncOff_Parallel(b *testing.B) { |
| 50 | ctx := context.Background() |
| 51 | WithDocker(ctx, b, false, func(b *testing.B, db *pgx.Conn, connstr string) { |
| 52 | b.ResetTimer() |
| 53 | defer b.StopTimer() |
| 54 | |
| 55 | for i := 0; i < b.N; i++ { |
| 56 | var g errgroup.Group |
| 57 | for k := 0; k < parallelCreate; k++ { |
| 58 | g.Go(func() error { |
| 59 | withDatabase(ctx, connstr, b, func(b *testing.B, db *pgx.Conn) { |
| 60 | _, _ = db.Exec(ctx, DatabaseSchema) |
| 61 | }) |
| 62 | return nil |
| 63 | }) |
| 64 | } |
| 65 | g.Wait() |
| 66 | |
| 67 | } |
| 68 | }) |
| 69 | } |
| 70 | |
| 71 | func WithDatabase[TB testing.TB](ctx context.Context, tb TB, fn func(t TB, db *pgx.Conn)) { |
| 72 | if *pgaddr == "" { |
nothing calls this directly
no test coverage detected