mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-01-06 00:40:10 -06:00
29 lines
509 B
Go
29 lines
509 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()
|
|
|
|
confLoader := &loader.ConfigLoader{}
|
|
|
|
conf, err := confLoader.LoadDatabaseConfig()
|
|
|
|
defer conf.Disconnect()
|
|
|
|
if err != nil {
|
|
t.Fatalf("failed to load database config: %v\n", err)
|
|
}
|
|
|
|
err = test(conf)
|
|
|
|
if err != nil {
|
|
t.Fatalf("%v\n", err)
|
|
}
|
|
}
|