2024-12-24 18:11:25 +00:00
|
|
|
package database_test
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
2025-01-14 17:28:26 +00:00
|
|
|
"os"
|
|
|
|
|
"path"
|
2024-12-24 18:11:25 +00:00
|
|
|
"queryorchestration/internal/database"
|
2025-01-10 19:17:20 +00:00
|
|
|
"queryorchestration/internal/test"
|
2024-12-24 18:11:25 +00:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestDBConn(t *testing.T) {
|
|
|
|
|
ctx := context.Background()
|
2025-01-10 19:17:20 +00:00
|
|
|
_, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
|
|
|
|
Migrations: &database.MigrationConfig{
|
2025-01-14 17:28:26 +00:00
|
|
|
BasePath: path.Join(os.Getenv("PWD"), "../.."),
|
2025-01-10 19:17:20 +00:00
|
|
|
},
|
|
|
|
|
})
|
2025-01-10 11:12:03 +00:00
|
|
|
defer cleanup()
|
2024-12-24 18:11:25 +00:00
|
|
|
|
2025-01-10 19:17:20 +00:00
|
|
|
pool := database.GetDBPool(ctx)
|
|
|
|
|
assert.NotNil(t, pool)
|
2025-01-08 18:14:15 +00:00
|
|
|
}
|