Merged in bugfix/flakydb (pull request #21)
Bugfix/flakydb * init * fixenvvar * fixtest
This commit is contained in:
@@ -2,6 +2,8 @@ package test_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"path"
|
||||
"queryorchestration/internal/database"
|
||||
"queryorchestration/internal/test"
|
||||
"testing"
|
||||
@@ -17,7 +19,7 @@ func TestCreateAPIContainer(t *testing.T) {
|
||||
dbcfg, dbcleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
||||
Network: ncfg,
|
||||
Migrations: &database.MigrationConfig{
|
||||
BasePath: "../..",
|
||||
BasePath: path.Join(os.Getenv("PWD"), "../.."),
|
||||
},
|
||||
})
|
||||
defer dbcleanup()
|
||||
|
||||
@@ -2,6 +2,8 @@ package test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"path"
|
||||
"queryorchestration/internal/database"
|
||||
"testing"
|
||||
|
||||
@@ -16,7 +18,7 @@ func TestCreateContainer(t *testing.T) {
|
||||
dbcfg, dbcleanup := CreateDB(t, ctx, &CreateDatabaseConfig{
|
||||
Network: ncfg,
|
||||
Migrations: &database.MigrationConfig{
|
||||
BasePath: "../..",
|
||||
BasePath: path.Join(os.Getenv("PWD"), "../.."),
|
||||
},
|
||||
})
|
||||
defer dbcleanup()
|
||||
|
||||
@@ -52,7 +52,8 @@ func CreateDB(t *testing.T, ctx context.Context, cfg *CreateDatabaseConfig) (*Da
|
||||
"POSTGRES_PASSWORD": pass,
|
||||
},
|
||||
ExposedPorts: []string{port.Port()},
|
||||
WaitingFor: wait.ForListeningPort(port),
|
||||
// WaitingFor: wait.ForLog("database system is ready to accept connections"),
|
||||
WaitingFor: wait.ForExposedPort(),
|
||||
}
|
||||
|
||||
if cfg.Network != nil {
|
||||
|
||||
@@ -2,6 +2,9 @@ package test_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"path"
|
||||
"queryorchestration/internal/database"
|
||||
"queryorchestration/internal/test"
|
||||
"testing"
|
||||
|
||||
@@ -19,3 +22,17 @@ func TestCreateDB(t *testing.T) {
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user