This commit is contained in:
parent
a92741f802
commit
8f516e74e9
|
@ -20,8 +20,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
goose.SetBaseFS(os.DirFS("../../migrations"))
|
setUpGoose()
|
||||||
goose.SetLogger(goose.NopLogger())
|
|
||||||
|
|
||||||
_, isDBDSNPresent := os.LookupEnv(envDBDSN)
|
_, isDBDSNPresent := os.LookupEnv(envDBDSN)
|
||||||
_, isRedisConnectionStringPresent := os.LookupEnv(envRedisConnectionString)
|
_, isRedisConnectionStringPresent := os.LookupEnv(envRedisConnectionString)
|
||||||
|
@ -64,6 +63,14 @@ func TestMain(m *testing.M) {
|
||||||
os.Exit(code)
|
os.Exit(code)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func setUpGoose() {
|
||||||
|
goose.SetBaseFS(os.DirFS("../../migrations"))
|
||||||
|
goose.SetLogger(goose.NopLogger())
|
||||||
|
if err := goose.SetDialect("postgres"); err != nil {
|
||||||
|
log.Fatalf("goose - couldn't set dialect: %s", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func newPostgres(pool *dockertest.Pool) (*dockertest.Resource, *url.URL) {
|
func newPostgres(pool *dockertest.Pool) (*dockertest.Resource, *url.URL) {
|
||||||
q := url.Values{}
|
q := url.Values{}
|
||||||
q.Add("sslmode", "disable")
|
q.Add("sslmode", "disable")
|
||||||
|
|
|
@ -52,7 +52,7 @@ func newBunDB(tb testing.TB) *bun.DB {
|
||||||
func runMigrations(tb testing.TB, db *sql.DB) {
|
func runMigrations(tb testing.TB, db *sql.DB) {
|
||||||
tb.Helper()
|
tb.Helper()
|
||||||
|
|
||||||
require.NoError(tb, goose.Up(db, ""))
|
require.NoError(tb, goose.Up(db, "."))
|
||||||
}
|
}
|
||||||
|
|
||||||
type bunfixture struct {
|
type bunfixture struct {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user