Files
query-orchestration/internal/test/ecosystem_test.go
T

80 lines
1.7 KiB
Go
Raw Normal View History

package test
import (
"context"
"os"
"path"
"testing"
"github.com/stretchr/testify/assert"
)
func TestCreateRunnerNetwork(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
conn, cleanup := CreateRunnerNetwork(t, ctx, &RunnerNetworkConfig{
Name: QueryRunner,
})
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,
})
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 := CreateBaseConfig()
cfg.BasePath = path.Join(os.Getenv("PWD"), "../..")
conn, cleanup := CreateRunnersAndServicesNetwork(t, ctx, &EcosystemNetworkConfig{
Cfg: cfg,
Runners: []*RunnerNetworkConfig{
{Name: QueryRunner},
},
Services: []*ServiceNetworkConfig{
{Name: QueryService},
},
})
assert.NotNil(t, conn)
assert.NotNil(t, cleanup)
cleanup()
}
func TestCreateBaseConfig(t *testing.T) {
cfg := CreateBaseConfig()
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)
}