Files
query-orchestration/internal/test/api_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

57 lines
1.2 KiB
Go

package test_test
import (
"context"
"os"
"path"
"queryorchestration/internal/serviceconfig"
"queryorchestration/internal/test"
"testing"
"github.com/stretchr/testify/assert"
)
func TestCreateAPIContainer(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
ncfg, ncleanup := test.CreateNetwork(t, ctx)
defer ncleanup()
t.Setenv("BASE_PATH", path.Join(os.Getenv("PWD"), "../.."))
cfg := &serviceconfig.BaseConfig{}
dbcfg, dbcleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
Network: ncfg,
Cfg: cfg,
RunMigrations: true,
})
defer dbcleanup()
acfg := &test.APIContainerConfig{
ServiceName: "queryService",
DB: dbcfg.External,
Network: ncfg,
}
conn, cleanup := test.CreateAPIContainer(t, ctx, acfg)
assert.NotNil(t, conn)
assert.NotNil(t, cleanup)
cleanup()
}
func TestCreateAPIWithDependencies(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
conn, cleanup := test.CreateAPIWithDependencies(t, ctx, "queryService")
assert.NotNil(t, conn)
assert.NotNil(t, cleanup)
cleanup()
}