2025-01-10 19:17:20 +00:00
|
|
|
package test
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"testing"
|
|
|
|
|
|
2025-03-05 12:05:46 +00:00
|
|
|
"queryorchestration/internal/serviceconfig"
|
|
|
|
|
|
2025-03-12 12:36:44 +00:00
|
|
|
"github.com/docker/go-connections/nat"
|
2025-01-10 19:17:20 +00:00
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestCreateContainer(t *testing.T) {
|
2025-01-17 12:00:32 +00:00
|
|
|
if testing.Short() {
|
|
|
|
|
t.Skip("Skipping long test in short mode")
|
|
|
|
|
}
|
2025-01-10 19:17:20 +00:00
|
|
|
ctx := context.Background()
|
|
|
|
|
|
2025-02-05 12:52:41 +00:00
|
|
|
cfg := &serviceconfig.BaseConfig{}
|
|
|
|
|
SetCfgProvider(t, cfg)
|
2025-02-03 17:30:50 +00:00
|
|
|
|
2025-04-22 14:40:16 +00:00
|
|
|
net := DepNetwork.Get(t, ctx)
|
|
|
|
|
|
|
|
|
|
_ = CreateDB(t, ctx, cfg, net, &CreateDatabaseConfig{})
|
2025-01-10 19:17:20 +00:00
|
|
|
|
2025-01-31 13:43:55 +00:00
|
|
|
ccfg := &containerConfig{
|
2025-04-02 18:50:03 +00:00
|
|
|
Name: string(QueryAPIName),
|
2025-03-17 18:14:15 +00:00
|
|
|
DownstreamQueues: QueryAPI.DownstreamQueues,
|
|
|
|
|
Cfg: cfg,
|
2025-03-12 12:36:44 +00:00
|
|
|
ExposedPorts: []nat.Port{
|
|
|
|
|
nat.Port("8080/tcp"),
|
|
|
|
|
},
|
2025-01-10 19:17:20 +00:00
|
|
|
}
|
|
|
|
|
|
2025-04-22 14:40:16 +00:00
|
|
|
container, cleanup := createContainer(t, ctx, net, ccfg)
|
2025-01-10 19:17:20 +00:00
|
|
|
assert.NotNil(t, container)
|
|
|
|
|
assert.NotNil(t, cleanup)
|
|
|
|
|
|
2025-03-19 11:54:14 +00:00
|
|
|
PrintContainerLogs(t, ctx, container)
|
|
|
|
|
|
2025-01-10 19:17:20 +00:00
|
|
|
cleanup()
|
|
|
|
|
}
|