7da57058d4
Bugfix/flakydb * init * fixenvvar * fixtest
39 lines
716 B
Go
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()
|
|
}
|