Documentation
¶
Overview ¶
Package stdtestcontainer provides re-usable code for using testcontainer-go.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // CreateGenericContainer sets the function used for creating the generic container, can be replaced for testing. CreateGenericContainer = testcontainers.GenericContainer // CleanupContainer sets the function used for cleaning up the container, can be replaced for testing. CleanupContainer = testcontainers.CleanupContainer )
Functions ¶
func Postgres ¶ added in v0.0.244
Postgres returns the connection URL of a PostgreSQL server that is shared by every test, and every test package, of the same `go test` run. The first call starts the server in a container; later calls, including those from other test packages (which Go runs in other processes), reuse it. Testcontainers' reaper (Ryuk) removes the container after the run, so tests never stop it themselves.
The image, e.g. "postgres:18", is required so the server matches the version the code runs against in production; callers asking for different images get different servers.
The server holds no data that tests can rely on: create a separate database per test on top of it, e.g. with pgtestdb or stdpgxtestfx. It requires a running Docker daemon.
func SetupLambdaRIEContainer ¶
func SetupLambdaRIEContainer( t *testing.T, ctx context.Context, imageName string, entrypoint []string, platform string, env map[string]string, hostRieFilePath string, hostAWSCredentialsFilePath string, ) *requests.Builder
SetupLambdaRIEContainer will use testcontainers-go to setup a container for e2e testing of a lambda handler.
Types ¶
This section is empty.