Files
query-orchestration/internal/test/queuecontainer_test.go
T

65 lines
1.3 KiB
Go
Raw Normal View History

package test
import (
"context"
"os"
"path"
"queryorchestration/internal/database"
"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()
dbcfg, dbcleanup := CreateDB(t, ctx, &CreateDatabaseConfig{
Migrations: &database.MigrationConfig{
BasePath: path.Join(os.Getenv("PWD"), "../.."),
},
Network: ncfg,
})
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,
}
cfg := &QueueContainerConfig{
ServiceName: "queryRunner",
DB: dbcfg.External,
Network: ncfg,
Queue: extcfg,
}
cleanup := CreateQueueContainer(t, ctx, cfg)
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()
}