Skip to content

Commit

Permalink
Fix conflicts after merge
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
  • Loading branch information
piotrpio committed Oct 13, 2023
1 parent dc8ed97 commit 981da31
Show file tree
Hide file tree
Showing 5 changed files with 1,143 additions and 312 deletions.
8 changes: 4 additions & 4 deletions nats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func WaitTime(ch chan bool, timeout time.Duration) error {
return errors.New("timeout")
}

func stackFatalf(t *testing.T, f string, args ...interface{}) {
func stackFatalf(t *testing.T, f string, args ...any) {
lines := make([]string, 0, 32)
msg := fmt.Sprintf(f, args...)
lines = append(lines, msg)
Expand Down Expand Up @@ -1576,7 +1576,7 @@ func TestNoPanicOnSrvPoolSizeChanging(t *testing.T) {
func TestHeaderParser(t *testing.T) {
shouldErr := func(hdr string) {
t.Helper()
if _, err := decodeHeadersMsg([]byte(hdr)); err == nil {
if _, err := DecodeHeadersMsg([]byte(hdr)); err == nil {
t.Fatalf("Expected an error")
}
}
Expand All @@ -1588,7 +1588,7 @@ func TestHeaderParser(t *testing.T) {
// Check that we can do inline status and descriptions
checkStatus := func(hdr string, status int, description string) {
t.Helper()
hdrs, err := decodeHeadersMsg([]byte(hdr + "\r\n\r\n"))
hdrs, err := DecodeHeadersMsg([]byte(hdr + "\r\n\r\n"))
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
Expand Down Expand Up @@ -1782,7 +1782,7 @@ func BenchmarkHeaderDecode(b *testing.B) {
}

for i := 0; i < b.N; i++ {
if _, err := decodeHeadersMsg(hdr); err != nil {
if _, err := DecodeHeadersMsg(hdr); err != nil {
b.Fatalf("Unexpected error: %v", err)
}
}
Expand Down
5 changes: 2 additions & 3 deletions test/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,14 @@ func TestServersOption(t *testing.T) {
}

func TestNewStyleServersOption(t *testing.T) {
nc, err := nats.Connect(nats.DefaultURL, nats.DontRandomize(), nats.Timeout(100*time.Millisecond))
_, err := nats.Connect(nats.DefaultURL, nats.DontRandomize(), nats.Timeout(100*time.Millisecond))
if runtime.GOOS == "windows" {
if err == nil || !strings.Contains(err.Error(), "timeout") {
t.Fatalf("Expected timeout, got %v", err)
}
} else if err != nats.ErrNoServers {
t.Fatalf("Wrong error: '%v'\n", err)
}
defer nc.Close()
servers := strings.Join(testServers, ",")

_, err = nats.Connect(servers, nats.DontRandomize(), nats.Timeout(100*time.Millisecond))
Expand All @@ -139,7 +138,7 @@ func TestNewStyleServersOption(t *testing.T) {
// Do this in case some failure occurs before explicit shutdown
defer s1.Shutdown()

nc, err = nats.Connect(servers, nats.DontRandomize(), nats.Timeout(100*time.Millisecond))
nc, err := nats.Connect(servers, nats.DontRandomize(), nats.Timeout(100*time.Millisecond))
if err != nil {
t.Fatalf("Could not connect: %v\n", err)
}
Expand Down
3 changes: 1 addition & 2 deletions test/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1058,13 +1058,12 @@ func TestConnectHandler(t *testing.T) {
connHandler := func(*nats.Conn) {
connected <- true
}
nc, err := nats.Connect(nats.DefaultURL,
_, err := nats.Connect(nats.DefaultURL,
nats.ConnectHandler(connHandler))

if err == nil {
t.Fatalf("Expected error on connect, got nil")
}
defer nc.Close()
select {
case <-connected:
t.Fatalf("ConnectedCB invoked when no connection established")
Expand Down
Loading

0 comments on commit 981da31

Please sign in to comment.