2025-02-03 17:30:50 +00:00
|
|
|
package test_test
|
|
|
|
|
|
|
|
|
|
import (
|
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"
|
|
|
|
|
)
|
|
|
|
|
|
2025-03-17 18:14:15 +00:00
|
|
|
func TestCreateAPI(t *testing.T) {
|
2025-04-25 17:02:50 +00:00
|
|
|
t.Parallel()
|
2025-02-03 17:30:50 +00:00
|
|
|
if testing.Short() {
|
2025-05-03 01:16:53 +00:00
|
|
|
t.SkipNow()
|
2025-02-03 17:30:50 +00:00
|
|
|
}
|
2025-04-22 14:40:16 +00:00
|
|
|
ctx := t.Context()
|
2025-02-03 17:30:50 +00:00
|
|
|
|
2025-02-05 12:52:41 +00:00
|
|
|
cfg := &serviceconfig.BaseConfig{}
|
2025-04-25 17:02:50 +00:00
|
|
|
_ = serviceconfig.InitializeConfig(cfg)
|
2025-05-03 11:29:10 +00:00
|
|
|
net := test.GetNetwork(t, ctx)
|
2025-04-25 17:02:50 +00:00
|
|
|
_ = test.CreateDB(t, ctx, cfg, net, &test.CreateDatabaseConfig{NoMigrations: true})
|
2025-02-03 17:30:50 +00:00
|
|
|
|
2025-03-17 18:14:15 +00:00
|
|
|
acfg := &test.APIConfig{
|
2025-04-22 14:40:16 +00:00
|
|
|
API: test.QueryAPI,
|
2025-02-03 17:30:50 +00:00
|
|
|
}
|
|
|
|
|
|
2025-04-22 14:40:16 +00:00
|
|
|
conn, cleanup := test.CreateAPI(t, ctx, cfg, net, acfg)
|
2025-02-03 17:30:50 +00:00
|
|
|
assert.NotNil(t, conn)
|
|
|
|
|
assert.NotNil(t, cleanup)
|
|
|
|
|
|
|
|
|
|
cleanup()
|
|
|
|
|
}
|