mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-01-05 08:09:50 -06:00
* feat: allow extending the api server * chore: remove internal packages to pkg * chore: update db_gen.go * fix: expose auth * fix: move logger to pkg * fix: don't generate gitignore for prisma client * fix: allow extensions to register their own api spec * feat: expose pool on server config * fix: nil pointer exception on empty opts * fix: run.go file
28 lines
529 B
Go
28 lines
529 B
Go
package testutils
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/hatchet-dev/hatchet/pkg/config/database"
|
|
"github.com/hatchet-dev/hatchet/pkg/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)
|
|
}
|
|
}
|