Documentation
¶
Overview ¶
Package gopherstack provides a Testcontainers module for Gopherstack.
It lets Go test suites spin up a real Gopherstack container (all AWS mock services on a single HTTP port) with a single call:
container, err := gopherstack.Run(ctx, "ghcr.io/blackbirdworks/gopherstack:latest") url, err := container.BaseURL(ctx) // url == "http://localhost:<mapped-port>"
All AWS SDK v2 clients can then be pointed at url without any other credential or region configuration changes.
Index ¶
Constants ¶
const (
// DefaultImage is the pre-built Gopherstack Docker image published to GHCR.
DefaultImage = "ghcr.io/blackbirdworks/gopherstack:latest"
)
Variables ¶
This section is empty.
Functions ¶
func WithEnv ¶
func WithEnv(env map[string]string) testcontainers.ContainerCustomizer
WithEnv returns a ContainerCustomizer that sets environment variables on the container. Keys and values are passed directly to Gopherstack, which exposes them as the usual AWS_* and service-specific variables.
Types ¶
type Container ¶
type Container struct {
testcontainers.Container
}
Container wraps testcontainers.Container and adds Gopherstack helpers.
func Run ¶
func Run(ctx context.Context, image string, opts ...testcontainers.ContainerCustomizer) (*Container, error)
Run starts a Gopherstack container using the provided Docker image and waits until the service is ready. The caller is responsible for terminating the container after use.
container, err := gopherstack.Run(ctx, gopherstack.DefaultImage) defer testcontainers.TerminateContainer(container)