Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/nats/nats.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type NATSContainer struct {
// Deprecated: use Run instead
// RunContainer creates an instance of the NATS container type
func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*NATSContainer, error) {
return Run(ctx, "nats:2.9", opts...)
return Run(ctx, "nats:2.11.7", opts...)
}

// Run creates an instance of the NATS container type
Expand All @@ -33,7 +33,7 @@ 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.ForLog("Server is ready"),
Copy link
Member

@mdelapenya mdelapenya Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: instead of relying on the log message, we should replace it with a wait for the listening port, which is more deterministic; besides we are more into using the wait for listening port strategy more and more. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, i noticed the listen port strategy is being used more and more in the project. still, i can imagine (hypothetically) a case where the listener comes up for a second and then the server crashes. do you think we better combine both or just keep wait for port?

WaitingFor: wait.ForAll(
  wait.ForListeningPort(defaultClientPort),
  wait.ForLog("Server is ready"),
)

}

genericContainerReq := testcontainers.GenericContainerRequest{
Expand Down
Loading