Skip to content

Commit

Permalink
fix(nats): port race on start up
Browse files Browse the repository at this point in the history
Wait for exposed ports instead of log to address race on start up.
  • Loading branch information
stevenh committed Aug 6, 2024
1 parent 8b42143 commit c919d2f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modules/nats/nats.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustom
Image: img,
ExposedPorts: []string{defaultClientPort, defaultRoutingPort, defaultMonitoringPort},
Cmd: []string{"-DV", "-js"},
WaitingFor: wait.ForLog("Listening for client connections on 0.0.0.0:4222"),
WaitingFor: wait.ForAll(
wait.ForExposedPortOnly(defaultClientPort),
wait.ForExposedPortOnly(defaultRoutingPort),
wait.ForExposedPortOnly(defaultMonitoringPort),
),
}

genericContainerReq := testcontainers.GenericContainerRequest{
Expand Down

0 comments on commit c919d2f

Please sign in to comment.