Skip to content

Commit

Permalink
refactor: improve NATS container startup strategy and testing reliabi…
Browse files Browse the repository at this point in the history
…lity

- 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 <appleboy.tw@gmail.com>
  • Loading branch information
appleboy committed Jan 19, 2025
1 parent b4e16d8 commit 372c48b
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions nats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ func setupNatsContainer(ctx context.Context, t *testing.T) (testcontainers.Conta
req := testcontainers.ContainerRequest{
Image: "nats:2.10",
ExposedPorts: []string{"4222/tcp"},
WaitingFor: wait.NewExecStrategy(
[]string{"wget", "http://localhost:8222/healthz", "-q", "-S", "-O", "-"},
),
WaitingFor: wait.ForLog("Server is ready"),
}
redisC, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
ContainerRequest: req,
Expand Down

0 comments on commit 372c48b

Please sign in to comment.