-
Notifications
You must be signed in to change notification settings - Fork 787
Open
Labels
defectSuspected defect such as a bug or regressionSuspected defect such as a bug or regression
Description
Observed behavior
After running a nats test server using this package github.com/nats-io/nats-server/v2/test and connecting to the server in tests using a code like this I saw that nats.ConnectHandler is not called after the initial connection is established. I expected to panic but the test doesn't panic
opts := []nats.Option{
nats.PingInterval(5*time.Second),
nats.MaxPingsOutstanding(5),
nats.MaxReconnects(-1),
nats.RetryOnFailedConnect(true),
nats.ReconnectHandler(func(c *nats.Conn) {
slog.Info("successfully reconnected to NATS")
}),
nats.ConnectHandler(func(c *nats.Conn) {
panic("called")
}),
nats.ReconnectErrHandler(func(c *nats.Conn, err error) {
slog.Error("error in reconnecting to NATS", slog.String("error", err.Error()))
}),
nats.DisconnectHandler(func(c *nats.Conn) {
slog.Info("successfully disconnected from NATS")
}),
}
conn, err := nats.Connect(url, opts...)Expected behavior
Test should panic
Server and client version
Server: github.com/nats-io/nats-server/v2 v2.11.3
Client: github.com/nats-io/nats.go v1.41.2
Host environment
No response
Steps to reproduce
No response
Metadata
Metadata
Assignees
Labels
defectSuspected defect such as a bug or regressionSuspected defect such as a bug or regression