Files
spinifex/tests/integration/service_daemon_lite.go
T
Julian Sommer b3be052311 test: remove integration conformance suite artefacts
Clear the warnings the conformance suite caused itself, so what remains is a real divergence from AWS:

- Seed conditionally required members into the base request of RDS CreateDBInstance and RestoreDBInstanceFromDBSnapshot, ECS CreateCapacityProvider and CreateService, and EC2 CreateCapacityReservation.
- Give loosely modelled members values AWS accepts: ELBv2 ProtocolVersion and Matcher.HttpCode, EKS policyArn, addonName and access-entry type, EC2 SourceRegion and STS AccessKeyId.
- Import a CA-signed certificate, key and chain in ACM ImportCertificate.
- Rewrite ACM's lookahead domain pattern as RE2 so RequestCertificate is generated, and give the integration ACM service a tenant CA permitting example.com.
- Run the service daemon-lite behind the cross-tenant boundary test.
- Accept ELBv2's common parameter validation errors in responses.
2026-09-29 11:05:22 +10:00

53 lines
2.2 KiB
Go

//go:build integration
package integration
import (
"path/filepath"
"testing"
"github.com/mulgadc/spinifex/spinifex/config"
handlers_acm "github.com/mulgadc/spinifex/spinifex/handlers/acm"
handlers_ecs "github.com/mulgadc/spinifex/spinifex/handlers/ecs"
handlers_eks "github.com/mulgadc/spinifex/spinifex/handlers/eks"
handlers_elbv2 "github.com/mulgadc/spinifex/spinifex/handlers/elbv2"
handlers_iam "github.com/mulgadc/spinifex/spinifex/handlers/iam"
handlers_rds "github.com/mulgadc/spinifex/spinifex/handlers/rds"
"github.com/stretchr/testify/require"
)
// StartServiceDaemonLite subscribes the real ACM, ECS, EKS, ELBv2 and RDS
// services to their "<service>.<Method>" subjects. ECS and RDS run without
// their provisioning dependencies, so checks that need them do not run.
func StartServiceDaemonLite(t *testing.T, gw *Gateway) {
t.Helper()
nc := gw.NATSConn
cfg := &config.Config{AZ: testAZ, Region: testRegion}
masterKey, err := handlers_iam.GenerateMasterKey()
require.NoError(t, err)
acm, err := handlers_acm.NewACMServiceImplWithNATS(t.Context(), cfg, nc, masterKey)
require.NoError(t, err, "construct ACM service")
// Without a tenant CA no mode can issue, so every RequestCertificate would
// be refused. The generated requests name example.com domains.
caDir := t.TempDir()
acm.TenantCA, err = handlers_acm.LoadOrCreateTenantCA(filepath.Join(caDir, "ca.pem"), filepath.Join(caDir, "ca.key"), []string{"example.com"})
require.NoError(t, err, "create ACM tenant CA")
subscribeServiceMethods(t, nc, "acm", acm)
elbv2, err := handlers_elbv2.NewELBv2ServiceImplWithNATS(cfg, nc, masterKey)
require.NoError(t, err, "construct ELBv2 service")
t.Cleanup(elbv2.Close)
subscribeServiceMethods(t, nc, "elbv2", elbv2)
eks, err := handlers_eks.NewEKSServiceImpl(handlers_eks.EKSServiceDeps{
Config: cfg, NATSConn: nc, MasterKey: masterKey, Region: testRegion, HolderID: "integration-test-node",
})
require.NoError(t, err, "construct EKS service")
t.Cleanup(eks.Shutdown)
subscribeServiceMethods(t, nc, "eks", eks)
subscribeServiceMethods(t, nc, "ecs", handlers_ecs.NewService(nc, testRegion, ""))
subscribeServiceMethods(t, nc, "rds", handlers_rds.NewService(nc, testRegion))
}