mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
close connections for test, return on err for pub
This commit is contained in:
@@ -60,7 +60,9 @@ func TestServerRestartReSliceIssue(t *testing.T) {
|
||||
go func() {
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
for i := 1; 1 <= 100; i++ {
|
||||
nc.Publish(subject, msg)
|
||||
if err := nc.Publish(subject, msg); err != nil {
|
||||
return
|
||||
}
|
||||
if i%10 == 0 {
|
||||
time.Sleep(time.Millisecond)
|
||||
}
|
||||
@@ -244,11 +246,14 @@ func TestRequestsAcrossRoutes(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create connection for nc1: %v\n", err)
|
||||
}
|
||||
defer nc1.Close()
|
||||
|
||||
nc2, err := nats.Connect(urlB)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create connection for nc2: %v\n", err)
|
||||
}
|
||||
defer nc2.Close()
|
||||
|
||||
ec2, _ := nats.NewEncodedConn(nc2, nats.JSON_ENCODER)
|
||||
|
||||
response := []byte("I will help you")
|
||||
@@ -282,11 +287,14 @@ func TestRequestsAcrossRoutesToQueues(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create connection for nc1: %v\n", err)
|
||||
}
|
||||
defer nc1.Close()
|
||||
|
||||
nc2, err := nats.Connect(urlB)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create connection for nc2: %v\n", err)
|
||||
}
|
||||
defer nc2.Close()
|
||||
|
||||
ec1, _ := nats.NewEncodedConn(nc1, nats.JSON_ENCODER)
|
||||
ec2, _ := nats.NewEncodedConn(nc2, nats.JSON_ENCODER)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user