mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2025-12-21 08:40:10 -06:00
* 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>
28 lines
523 B
Go
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)
|
|
}
|
|
}
|