Skip to content

Commit

Permalink
Close connection to base DB after cleanup
Browse files Browse the repository at this point in the history
When running multiple quick tests in parallel it's possible to get a connection failure due to too many clients connected.
  • Loading branch information
ebabani committed Jan 8, 2024
1 parent 8080014 commit bdeb9d9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions testdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ func create(t testing.TB, conf Config, migrator Migrator) (*Config, *sql.DB) {
}

t.Cleanup(func() {
defer baseDB.Close()

// Close the testDB
if err := db.Close(); err != nil {
t.Fatalf("could not close test database: '%s': %s", instance.Database, err)
Expand Down

0 comments on commit bdeb9d9

Please sign in to comment.