36 lines
662 B
Go
36 lines
662 B
Go
|
|
package test
|
||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
"queryorchestration/internal/database"
|
||
|
|
"testing"
|
||
|
|
|
||
|
|
"github.com/stretchr/testify/assert"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestCreateContainer(t *testing.T) {
|
||
|
|
ctx := context.Background()
|
||
|
|
|
||
|
|
ncfg, ncleanup := CreateNetwork(t, ctx)
|
||
|
|
defer ncleanup()
|
||
|
|
dbcfg, dbcleanup := CreateDB(t, ctx, &CreateDatabaseConfig{
|
||
|
|
Network: ncfg,
|
||
|
|
Migrations: &database.MigrationConfig{
|
||
|
|
BasePath: "../..",
|
||
|
|
},
|
||
|
|
})
|
||
|
|
defer dbcleanup()
|
||
|
|
|
||
|
|
cfg := &containerConfig{
|
||
|
|
ServiceName: "queryService",
|
||
|
|
DB: dbcfg.External,
|
||
|
|
Network: ncfg,
|
||
|
|
}
|
||
|
|
|
||
|
|
container, cleanup := createContainer(t, ctx, cfg)
|
||
|
|
assert.NotNil(t, container)
|
||
|
|
assert.NotNil(t, cleanup)
|
||
|
|
|
||
|
|
cleanup()
|
||
|
|
}
|