Files
query-orchestration/internal/test/database_test.go
T
Michael McGuinness fa95d733ca Merged in feature/shorttestsanddirtidy (pull request #26)
Add short tests and Tidy internal directories

* complete the tasks
2025-01-17 12:00:32 +00:00

45 lines
895 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) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
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) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
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()
}