Registry / testing / testcontainers-testcontainers-go

testcontainers-testcontainers-go

JSON →
library0.42.0gogounverified

A Go library that provides lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container for integration testing.

go get github.com/testcontainers/testcontainers-go
INSTALL
IMPORT
SIG · TESTCONTAINERS-TES
T
testcontainers-testcontainers-go
testinggov0.42.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

testcontainers
github.com/testcontainers/testcontainers-go

Starts an nginx container and waits for it to be ready.

package main import ( "context" "fmt" "github.com/testcontainers/testcontainers-go" "github.com/testcontainers/testcontainers-go/wait" ) func main() { ctx := context.Background() req := testcontainers.ContainerRequest{ Image: "nginx:latest", ExposedPorts: []string{"80/tcp"}, WaitingFor: wait.ForHTTP("/"), } container, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{ ContainerRequest: req, Started: true, }) if err != nil { panic(err) } defer container.Terminate(ctx) fmt.Println("Container started") }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
0.42.0latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
testcontainers-testcontainers-go — go get testcontainers-testcontainers-go · libregistry