diff --git a/examples/pulsar/pulsar.go b/examples/pulsar/pulsar.go index 920d8782cf..94a0663e6f 100644 --- a/examples/pulsar/pulsar.go +++ b/examples/pulsar/pulsar.go @@ -4,11 +4,14 @@ import ( "context" "fmt" "io" + "time" "github.com/testcontainers/testcontainers-go" "github.com/testcontainers/testcontainers-go/wait" ) +const defaultTimeout = time.Minute * 3 + type pulsarContainer struct { testcontainers.Container URI string @@ -24,9 +27,9 @@ func setupPulsar(ctx context.Context) (*pulsarContainer, error) { Image: "docker.io/apachepulsar/pulsar:2.10.2", ExposedPorts: []string{"6650/tcp", "8080/tcp"}, WaitingFor: wait.ForAll( - wait.ForHTTP("/admin/v2/clusters").WithPort("8080/tcp").WithResponseMatcher(matchAdminResponse), - wait.ForLog("Successfully updated the policies on namespace public/default"), - ), + wait.ForHTTP("/admin/v2/clusters").WithPort("8080/tcp").WithResponseMatcher(matchAdminResponse).WithStartupTimeout(defaultTimeout), + wait.ForLog("Successfully updated the policies on namespace public/default").WithStartupTimeout(defaultTimeout), + ).WithStartupTimeout(defaultTimeout), Cmd: []string{ "/bin/bash", "-c", diff --git a/examples/pulsar/pulsar_test.go b/examples/pulsar/pulsar_test.go index fee8959547..aa7724ff05 100644 --- a/examples/pulsar/pulsar_test.go +++ b/examples/pulsar/pulsar_test.go @@ -10,7 +10,7 @@ import ( ) func TestPulsar(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) + ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout) defer cancel() c, err := setupPulsar(ctx)