Skip to content

Commit

Permalink
test: cleanup test databases to avoid side-effects (#927)
Browse files Browse the repository at this point in the history
  • Loading branch information
bevzzz authored Jan 6, 2024
1 parent 8c4d8be commit 6044ecf
Show file tree
Hide file tree
Showing 8 changed files with 156 additions and 203 deletions.
8 changes: 3 additions & 5 deletions internal/dbtest/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func benchEachDB(b *testing.B, f func(b *testing.B, db *bun.DB)) {
db.SetMaxOpenConns(64)
db.SetMaxIdleConns(64)

err := resetBenchSchema(db)
err := resetBenchSchema(b, db)
require.NoError(b, err)

b.ResetTimer()
Expand All @@ -86,10 +86,8 @@ func benchEachDB(b *testing.B, f func(b *testing.B, db *bun.DB)) {
}
}

func resetBenchSchema(db *bun.DB) error {
if err := db.ResetModel(ctx, (*Bench)(nil)); err != nil {
return err
}
func resetBenchSchema(tb testing.TB, db *bun.DB) error {
mustResetModel(tb, ctx, db, (*Bench)(nil))

for i := 0; i < 1000; i++ {
bench := &Bench{
Expand Down
Loading

0 comments on commit 6044ecf

Please sign in to comment.