2025-02-03 17:30:50 +00:00
|
|
|
package test_test
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"os"
|
|
|
|
|
"path"
|
2025-03-05 12:05:46 +00:00
|
|
|
"testing"
|
|
|
|
|
|
2025-02-05 12:52:41 +00:00
|
|
|
"queryorchestration/internal/serviceconfig"
|
2025-02-03 17:30:50 +00:00
|
|
|
"queryorchestration/internal/test"
|
|
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestCreateService(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()
|
|
|
|
|
|
2025-02-05 12:52:41 +00:00
|
|
|
cfg := &serviceconfig.BaseConfig{}
|
|
|
|
|
test.SetCfgProvider(t, cfg)
|
|
|
|
|
cfg.SetBasePath(path.Join(os.Getenv("PWD"), "../.."))
|
2025-02-03 17:30:50 +00:00
|
|
|
_, dbcleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
|
|
|
|
Network: ncfg,
|
|
|
|
|
Cfg: cfg,
|
|
|
|
|
})
|
|
|
|
|
defer dbcleanup()
|
|
|
|
|
|
|
|
|
|
acfg := &test.ServiceConfig{
|
|
|
|
|
Name: test.QueryService,
|
|
|
|
|
Cfg: cfg,
|
|
|
|
|
Network: ncfg,
|
2025-02-12 19:00:25 +00:00
|
|
|
Env: map[string]string{
|
2025-03-10 11:03:00 +00:00
|
|
|
"CLIENT_SYNC_URL": "/i/am/here",
|
2025-02-14 10:56:24 +00:00
|
|
|
"QUERY_VERSION_SYNC_URL": "/here/there/every/where",
|
2025-02-12 19:00:25 +00:00
|
|
|
},
|
2025-02-03 17:30:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
conn, cleanup := test.CreateService(t, ctx, acfg)
|
|
|
|
|
assert.NotNil(t, conn)
|
|
|
|
|
assert.NotNil(t, cleanup)
|
|
|
|
|
|
|
|
|
|
cleanup()
|
|
|
|
|
}
|