Skip to content

Commit 738e8fc

Browse files
authored
chore: use a much smaller image for testing (testcontainers#2795)
1 parent 309dec1 commit 738e8fc

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

wait/exec_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,17 @@ import (
2222
func ExampleExecStrategy() {
2323
ctx := context.Background()
2424
req := testcontainers.ContainerRequest{
25-
Image: "localstack/localstack:latest",
26-
WaitingFor: wait.ForExec([]string{"awslocal", "dynamodb", "list-tables"}),
25+
Image: "alpine:latest",
26+
Entrypoint: []string{"tail", "-f", "/dev/null"}, // needed for the container to stay alive
27+
WaitingFor: wait.ForExec([]string{"ls", "/"}).WithStartupTimeout(1 * time.Second),
2728
}
2829

29-
localstack, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
30+
ctr, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
3031
ContainerRequest: req,
3132
Started: true,
3233
})
3334
defer func() {
34-
if err := testcontainers.TerminateContainer(localstack); err != nil {
35+
if err := testcontainers.TerminateContainer(ctr); err != nil {
3536
log.Printf("failed to terminate container: %s", err)
3637
}
3738
}()
@@ -40,7 +41,7 @@ func ExampleExecStrategy() {
4041
return
4142
}
4243

43-
state, err := localstack.State(ctx)
44+
state, err := ctr.State(ctx)
4445
if err != nil {
4546
log.Printf("failed to get container state: %s", err)
4647
return

0 commit comments

Comments
 (0)