From da4f1d0759ee5993b8ed36742d938ee78e18b9ff Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Thu, 24 Jun 2021 12:27:55 +0200 Subject: [PATCH 1/2] test(transport/nats): remove nats server address log line The running bit is set way earlier than the listener that s.Addr returns. This lead to panics on several occasions when the listener was not yet set. Moving after ReadyForConnections could be a solution, but logging the nats server address does not add much to the test anyway: the address is logged if there is an error. Signed-off-by: Mark Sagi-Kazar --- transport/nats/subscriber_test.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/transport/nats/subscriber_test.go b/transport/nats/subscriber_test.go index 2b0808430..73a76cddf 100644 --- a/transport/nats/subscriber_test.go +++ b/transport/nats/subscriber_test.go @@ -42,8 +42,6 @@ func newNATSConn(t *testing.T) (*server.Server, *nats.Conn) { t.Fatal("not yet running") } - t.Log(s.Addr().String()) - if ok := s.ReadyForConnections(5 * time.Second); !ok { t.Fatal("not ready for connections") } From 835cefbbcc7e547de248c98fa8343e1e48fe0496 Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Thu, 24 Jun 2021 12:30:55 +0200 Subject: [PATCH 2/2] test(transport/nats): remove unused code Signed-off-by: Mark Sagi-Kazar --- transport/nats/subscriber_test.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/transport/nats/subscriber_test.go b/transport/nats/subscriber_test.go index 73a76cddf..fc97c1fb7 100644 --- a/transport/nats/subscriber_test.go +++ b/transport/nats/subscriber_test.go @@ -46,10 +46,6 @@ func newNATSConn(t *testing.T) (*server.Server, *nats.Conn) { t.Fatal("not ready for connections") } - //if n := s.NumSubscriptions(); n > 0 { - // t.Fatalf("found %d active subscriptions on the server", n) - //} - c, err := nats.Connect("nats://"+s.Addr().String(), nats.Name(t.Name())) if err != nil { t.Fatalf("failed to connect to NATS server: %s", err)