555b6d420b
Document Result Endpoint * testing * cleantesting * progress * query * lint * readme * dockerclient * api * passtest * tests * test
45 lines
833 B
Go
45 lines
833 B
Go
package test_test
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"path"
|
|
"testing"
|
|
|
|
"queryorchestration/internal/serviceconfig"
|
|
"queryorchestration/internal/test"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestCreateAPI(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()
|
|
|
|
cfg := &serviceconfig.BaseConfig{}
|
|
test.SetCfgProvider(t, cfg)
|
|
cfg.SetBasePath(path.Join(os.Getenv("PWD"), "../.."))
|
|
_, dbcleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
|
Network: ncfg,
|
|
Cfg: cfg,
|
|
})
|
|
defer dbcleanup()
|
|
|
|
acfg := &test.APIConfig{
|
|
API: test.QueryAPI,
|
|
Cfg: cfg,
|
|
Network: ncfg,
|
|
}
|
|
|
|
conn, cleanup := test.CreateAPI(t, ctx, acfg)
|
|
assert.NotNil(t, conn)
|
|
assert.NotNil(t, cleanup)
|
|
|
|
cleanup()
|
|
}
|