Files
query-orchestration/internal/test/database_test.go
T
Michael McGuinness 5ca36b0502 Merged in feature/listtypes (pull request #23)
Feature/listtypes

* started

* cleanuplist

* someunittestfixes

* removemostflakiness
2025-01-15 12:19:49 +00:00

39 lines
755 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{})
assert.NotNil(t, dbcfg)
assert.Nil(t, dbcfg.Pool)
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, dbcfg.Pool)
assert.NotNil(t, cleanup)
cleanup()
}