721ca8a6e6
Dockerfile in Test * dockerfile * network * const
59 lines
1.1 KiB
Go
59 lines
1.1 KiB
Go
package test
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"queryorchestration/internal/serviceconfig"
|
|
"queryorchestration/internal/serviceconfig/objectstore"
|
|
|
|
"github.com/docker/go-connections/nat"
|
|
"github.com/gruntwork-io/terratest/modules/docker"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestBuildImage(t *testing.T) {
|
|
if testing.Short() {
|
|
t.SkipNow()
|
|
}
|
|
buildImage(t, t.Context())
|
|
|
|
exists := docker.DoesImageExist(t, imageTag, nil)
|
|
assert.True(t, exists)
|
|
}
|
|
|
|
type Cfg struct {
|
|
serviceconfig.BaseConfig
|
|
objectstore.ObjectStoreConfig
|
|
}
|
|
|
|
func TestCreateContainer(t *testing.T) {
|
|
t.Parallel()
|
|
if testing.Short() {
|
|
t.SkipNow()
|
|
}
|
|
ctx := context.Background()
|
|
|
|
cfg := &Cfg{}
|
|
|
|
deps, clean := CreateFullDependencies(t, ctx, cfg)
|
|
defer clean()
|
|
|
|
ccfg := &containerConfig{
|
|
Name: string(QueryAPIName),
|
|
DownstreamQueues: QueryAPI.DownstreamQueues,
|
|
Cfg: cfg,
|
|
ExposedPorts: []nat.Port{
|
|
nat.Port("8080/tcp"),
|
|
},
|
|
}
|
|
|
|
container, cleanup := createContainer(t, ctx, deps.Network, ccfg)
|
|
assert.NotNil(t, container)
|
|
assert.NotNil(t, cleanup)
|
|
|
|
PrintContainerLogs(t, ctx, container)
|
|
|
|
cleanup()
|
|
}
|