mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2025-12-30 13:19:44 -06:00
* chore: ignore or fix linter errors * chore: wrap up lint errors * chore: sqlc generation --------- Co-authored-by: Alexander Belanger <belanger@sas.upenn.edu>
28 lines
539 B
Go
28 lines
539 B
Go
package testutils
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/hatchet-dev/hatchet/internal/config/database"
|
|
"github.com/hatchet-dev/hatchet/internal/config/loader"
|
|
)
|
|
|
|
func RunTestWithDatabase(t *testing.T, test func(config *database.Config) error) {
|
|
t.Helper()
|
|
Prepare(t)
|
|
|
|
confLoader := &loader.ConfigLoader{}
|
|
|
|
conf, err := confLoader.LoadDatabaseConfig()
|
|
if err != nil {
|
|
t.Fatalf("failed to load database config: %v\n", err)
|
|
}
|
|
defer conf.Disconnect() // nolint: errcheck
|
|
|
|
err = test(conf)
|
|
|
|
if err != nil {
|
|
t.Fatalf("%v\n", err)
|
|
}
|
|
}
|