//go:build integration package integration import ( "testing" "github.com/mulgadc/spinifex/spinifex/bootstrap/config" ec2launchtemplate "github.com/mulgadc/spinifex/spinifex/domains/ec2/launchtemplate" "github.com/stretchr/testify/require" ) // StartLaunchTemplateDaemonLite subscribes a real // ec2launchtemplate.LaunchTemplateServiceImpl — the same production // code a live daemon runs (daemon/daemon_handlers_launchtemplate.go) — to // every ec2.*LaunchTemplate* subject the gateway's NATSLaunchTemplateService // client calls (domains/ec2/awsapi/launchtemplate/*.go, RunInstances.go's // expandLaunchTemplate). Unlike StubSubject's static canned JSON, this // exercises the real KV-backed CRUD and version-resolution logic, matching // how RunInstances resolves a referenced template into effective ImageId/ // InstanceType before the per-node launch dispatch. // // Kept separate from StartDaemonLite (rather than folded into it) following // StartVolumeDaemonLite's precedent: only a test that actually exercises // launch templates should pay for wiring this service. func StartLaunchTemplateDaemonLite(t *testing.T, gw *Gateway) *ec2launchtemplate.LaunchTemplateServiceImpl { t.Helper() cfg := &config.Config{AZ: testAZ} svc, err := ec2launchtemplate.NewLaunchTemplateServiceImplWithNATS(t.Context(), cfg, gw.NATSConn) require.NoError(t, err, "construct launch template service") subscribeServiceMethods(t, gw.NATSConn, "ec2", svc) return svc }