Files
query-orchestration/internal/test/queuecontainer_test.go
T
Jay Brown 15adaebfcd Merged in feature/serviceconfig-integration (pull request #38)
DRAFT PR : WIP working through ideas for integration

* movearound

* attempttwo

* openapi

* further sanding

* fix

* start on tests

* runthroughsingleconfig

* somechanges

* reflectissue

* removeerrs

* mostlyremovepanic

* removeenv

* noncfgtests

* go

* repo

* fix service config test

* add PWD to all

* test fix

* fix lint

* todo for later

* passingunittests

* alltests

* testlogger

* testloggername

* clean
2025-01-31 13:43:55 +00:00

68 lines
1.4 KiB
Go

package test
import (
"context"
"os"
"path"
"queryorchestration/internal/serviceconfig"
"testing"
"github.com/stretchr/testify/assert"
)
func TestCreateQueueContainer(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
ncfg, ncleanup := CreateNetwork(t, ctx)
defer ncleanup()
t.Setenv("BASE_PATH", path.Join(os.Getenv("PWD"), "../.."))
cfg := &serviceconfig.BaseConfig{}
dbcfg, dbcleanup := CreateDB(t, ctx, &CreateDatabaseConfig{
Network: ncfg,
Cfg: cfg,
RunMigrations: true,
})
defer dbcleanup()
qcfg, qcleanup := CreateQueue(t, ctx, &CreateQueueConfig{
Network: ncfg,
})
defer qcleanup()
extcfg := &queueConfig{
URL: qcfg.URL,
Region: qcfg.External.Region,
Endpoint: qcfg.External.Endpoint,
Credentials: qcfg.External.Credentials,
}
qccfg := &QueueContainerConfig{
ServiceName: "queryRunner",
DB: dbcfg.External,
Network: ncfg,
Queue: extcfg,
}
cleanup := CreateQueueContainer(t, ctx, qccfg)
assert.NotNil(t, cleanup)
cleanup()
}
func TestCreateQueueWithDependencies(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
conn, cleanup := CreateQueueWithDependencies(t, ctx, "queryRunner")
assert.NotNil(t, conn)
assert.NotNil(t, cleanup)
cleanup()
}