7001ca854c
Queuing Changes and Cfg Testing * staarting * staarting * startedpush * note * save * mocking * removederrs * fixtests * cleanuperrs * newenvsetup * preppingtests * queue * mmovetocfgpassunittests * sortoutconfig * passinginteg * deps * fixtests
49 lines
989 B
Go
49 lines
989 B
Go
package test_test
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"path"
|
|
"queryorchestration/internal/test"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestCreateDB(t *testing.T) {
|
|
if testing.Short() {
|
|
t.Skip("Skipping long test in short mode")
|
|
}
|
|
ctx := context.Background()
|
|
|
|
cfg := test.CreateBaseConfig()
|
|
cfg.BasePath = path.Join(os.Getenv("PWD"), "../..")
|
|
|
|
dbcfg, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{Cfg: cfg})
|
|
assert.NotNil(t, dbcfg)
|
|
assert.Nil(t, cfg.DBPool)
|
|
assert.NotNil(t, cleanup)
|
|
|
|
cleanup()
|
|
}
|
|
|
|
func TestCreateDBWithMigrations(t *testing.T) {
|
|
if testing.Short() {
|
|
t.Skip("Skipping long test in short mode")
|
|
}
|
|
ctx := context.Background()
|
|
|
|
cfg := test.CreateBaseConfig()
|
|
cfg.BasePath = path.Join(os.Getenv("PWD"), "../..")
|
|
|
|
dbcfg, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
|
Cfg: cfg,
|
|
RunMigrations: true,
|
|
})
|
|
defer cleanup()
|
|
|
|
assert.NotNil(t, dbcfg)
|
|
assert.NotNil(t, cfg.DBPool)
|
|
assert.NotNil(t, cleanup)
|
|
}
|