Skip to content

Commit

Permalink
chore: use a much smaller image for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
mdelapenya committed Sep 23, 2024
1 parent 1d01e21 commit 2927239
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions wait/exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,17 @@ import (
func ExampleExecStrategy() {
ctx := context.Background()
req := testcontainers.ContainerRequest{
Image: "localstack/localstack:latest",
WaitingFor: wait.ForExec([]string{"awslocal", "dynamodb", "list-tables"}),
Image: "alpine:latest",
Entrypoint: []string{"tail", "-f", "/dev/null"}, // needed for the container to stay alive
WaitingFor: wait.ForExec([]string{"ls", "/"}).WithStartupTimeout(1 * time.Second),
}

localstack, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
ctr, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
ContainerRequest: req,
Started: true,
})
defer func() {
if err := testcontainers.TerminateContainer(localstack); err != nil {
if err := testcontainers.TerminateContainer(ctr); err != nil {
log.Printf("failed to terminate container: %s", err)
}
}()
Expand All @@ -40,7 +41,7 @@ func ExampleExecStrategy() {
return
}

state, err := localstack.State(ctx)
state, err := ctr.State(ctx)
if err != nil {
log.Printf("failed to get container state: %s", err)
return
Expand Down

0 comments on commit 2927239

Please sign in to comment.