Files
hatchet/internal/testutils/with_database.go
Sean Reilly a8dd33c61f Feature - configurable logging backend (#1188)
* allow us to configure different repos

* make the struct contents public

* pass in config values to new log repo

* rename functions - possibly breaking changes so lets discuss

* make the logging backend configurable

* fix tests

* don't allow calls to WithAdditionalConfig

* cleanup

* replace sc with server

Co-authored-by: abelanger5 <belanger@sas.upenn.edu>

* rename sc to server

* add a LRU cache for the step run lookup

* lets not use an expirable cache and just use the regular one - we cannot close the go func in exirable

---------

Co-authored-by: abelanger5 <belanger@sas.upenn.edu>
2025-01-17 15:34:10 -08:00

28 lines
523 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.Layer) error) {
t.Helper()
Prepare(t)
confLoader := &loader.ConfigLoader{}
conf, err := confLoader.InitDataLayer()
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)
}
}