Skip to content

Commit 372c48b

Browse files
committed
refactor: improve NATS container startup strategy and testing reliability
- Change the NATS container waiting strategy from executing a wget command to waiting for a specific log message "Server is ready" Signed-off-by: appleboy <[email protected]>
1 parent b4e16d8 commit 372c48b

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

nats_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ func setupNatsContainer(ctx context.Context, t *testing.T) (testcontainers.Conta
3939
req := testcontainers.ContainerRequest{
4040
Image: "nats:2.10",
4141
ExposedPorts: []string{"4222/tcp"},
42-
WaitingFor: wait.NewExecStrategy(
43-
[]string{"wget", "http://localhost:8222/healthz", "-q", "-S", "-O", "-"},
44-
),
42+
WaitingFor: wait.ForLog("Server is ready"),
4543
}
4644
redisC, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
4745
ContainerRequest: req,

0 commit comments

Comments
 (0)