Files
query-orchestration/internal/test/database_test.go
T
Michael McGuinness 7da57058d4 Merged in bugfix/flakydb (pull request #21)
Bugfix/flakydb

* init

* fixenvvar

* fixtest
2025-01-14 17:28:26 +00:00

39 lines
716 B
Go

package test_test
import (
"context"
"os"
"path"
"queryorchestration/internal/database"
"queryorchestration/internal/test"
"testing"
"github.com/stretchr/testify/assert"
)
func TestCreateDB(t *testing.T) {
ctx := context.Background()
dbcfg, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
NoPool: true,
})
assert.NotNil(t, dbcfg)
assert.NotNil(t, cleanup)
cleanup()
}
func TestCreateDBWithMigrations(t *testing.T) {
ctx := context.Background()
dbcfg, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
Migrations: &database.MigrationConfig{
BasePath: path.Join(os.Getenv("PWD"), "../.."),
},
})
assert.NotNil(t, dbcfg)
assert.NotNil(t, cleanup)
cleanup()
}