Files
query-orchestration/internal/test/ecosystem_test.go
T
Michael McGuinness 6648cdf1cb Merged in feature/clientexternalid (pull request #99)
Client External ID

* normalizeexternalid

* cleanopenapi

* cleanopenapi

* changingpublic

* noprecommit

* testing

* precommit

* processtest

* nodb

* tests

* tests
2025-03-11 16:31:06 +00:00

141 lines
3.1 KiB
Go

package test
import (
"context"
"testing"
"queryorchestration/internal/serviceconfig"
"queryorchestration/internal/serviceconfig/objectstore"
"github.com/stretchr/testify/assert"
)
func TestCreateRunnerNetwork(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
cfg := &serviceconfig.BaseConfig{}
SetCfgProvider(t, cfg)
conn, cleanup := CreateRunnerNetwork(t, ctx, &RunnerNetworkConfig{
Cfg: cfg,
Name: QueryRunner,
Env: map[string]string{
"QUERY_URL": "/i/am/here",
"QUERY_VERSION_SYNC_URL": "/here/there/every/where",
},
})
assert.NotNil(t, conn)
assert.NotNil(t, cleanup)
cleanup()
}
func TestCreateServiceNetwork(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
conn, cleanup := CreateServiceNetwork(t, ctx, &ServiceNetworkConfig{
Name: QueryService,
Env: map[string]string{
"CLIENT_SYNC_URL": "/i/am/here",
"QUERY_VERSION_SYNC_URL": "/here/there/every/where",
},
})
assert.NotNil(t, conn)
assert.NotNil(t, cleanup)
cleanup()
}
func TestCreateRunnersAndServicesNetwork(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
cfg := &serviceconfig.BaseConfig{}
SetCfgProviderWithBasePath(t, cfg, "../..")
conn, cleanup := CreateRunnersAndServicesNetwork(t, ctx, &EcosystemNetworkConfig{
Cfg: cfg,
Runners: []*RunnerNetworkConfig{
{
Name: QueryRunner,
Env: map[string]string{
"QUERY_URL": "/i/am/here",
},
},
},
Services: []*ServiceNetworkConfig{
{
Name: QueryService,
Env: map[string]string{
"CLIENT_SYNC_URL": "/i/am/here",
"QUERY_VERSION_SYNC_URL": "/here/there/every/where",
},
},
},
})
assert.NotNil(t, conn)
assert.NotNil(t, cleanup)
cleanup()
}
func TestCreateBaseConfig(t *testing.T) {
cfg := &serviceconfig.BaseConfig{}
SetCfgProvider(t, cfg)
assert.Equal(t, "test", cfg.AWSKeyID)
assert.Equal(t, "test", cfg.AWSSecretKey)
assert.Equal(t, "us-east-1", cfg.AWSRegion)
assert.Equal(t, "invalid_user", cfg.DBUser)
assert.Equal(t, "invalid_pass", cfg.DBSecret)
assert.Equal(t, "invalid_host", cfg.DBHost)
assert.Equal(t, 5432, cfg.DBPort)
assert.Equal(t, "invalid_name", cfg.DBName)
assert.True(t, cfg.DBNoSSL)
}
type FullDepsConfig struct {
serviceconfig.BaseConfig
objectstore.ObjectStoreConfig
}
func TestCreateFullDependencies(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
cfg := &FullDepsConfig{}
SetCfgProviderWithBasePath(t, cfg, "../..")
conn, cleanup := CreateFullDependencies(t, ctx, cfg)
assert.NotNil(t, conn)
assert.NotNil(t, cleanup)
cleanup()
}
func TestCreateNetwork(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
cfg := &FullDepsConfig{}
SetCfgProviderWithBasePath(t, cfg, "../..")
conn, cleanup := CreateFullNetwork(t, ctx, cfg)
assert.NotNil(t, conn)
assert.NotNil(t, cleanup)
cleanup()
}