Files
query-orchestration/internal/test/database_test.go
T
Michael McGuinness 92334ad1dd Merged in feature/s3integration (pull request #47)
Set Up S3 integration

* cfginterfaceandfirsts3funcs

* addlocalstack

* generallypassesfullsuite

* addedmultipleattemptedpings

* cleanup

* stabiliseplusskip
2025-02-05 12:52:41 +00:00

52 lines
1.1 KiB
Go

package test_test
import (
"context"
"os"
"path"
"queryorchestration/internal/serviceconfig"
"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 := &serviceconfig.BaseConfig{}
test.SetCfgProvider(t, cfg)
cfg.SetBasePath(path.Join(os.Getenv("PWD"), "../.."))
dbcfg, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{Cfg: cfg})
assert.NotNil(t, dbcfg)
assert.Nil(t, cfg.GetDBPool())
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 := &serviceconfig.BaseConfig{}
test.SetCfgProvider(t, cfg)
cfg.SetBasePath(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.GetDBPool())
assert.NotNil(t, cleanup)
}