Demonstrates using testcontainers-floci-go to test SNS→SQS fan-out against a local Floci instance.
The test:
- Starts a Floci container
- Creates an SNS topic
- Creates an SQS queue and subscribes it to the topic
- Publishes a message to the topic
- Receives the message from SQS and verifies the SNS notification payload
go test -v -timeout 300s ./examples/sns/...// Start Floci
fc, err := floci.NewFlociContainer().Start(ctx)
t.Cleanup(func() { _ = fc.Stop(ctx) })
// Wire up SNS and SQS clients from the same config
cfg, err := config.LoadDefaultConfig(ctx,
config.WithRegion(fc.GetRegion()),
config.WithBaseEndpoint(fc.GetEndpoint()),
config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider(
fc.GetAccessKey(), fc.GetSecretKey(), "",
)),
)
snsClient := sns.NewFromConfig(cfg)
sqsClient := sqs.NewFromConfig(cfg)