Skip to content

Commit

Permalink
refactor: upgrade to go 1.23.0 and remove skipped test
Browse files Browse the repository at this point in the history
  • Loading branch information
Tochemey committed Feb 9, 2025
1 parent bfb77fe commit f970339
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions internal/memberlist/transport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"os"
"strconv"
"strings"
"sync"
"testing"
"time"

Expand Down Expand Up @@ -163,7 +164,7 @@ func TestTCPTransport(t *testing.T) {
require.NoError(t, err)

util.Pause(time.Second)
require.Len(t, cluster.delegates[1].Msgs, 1)
require.Len(t, cluster.delegates[1].Messages(), 1)
})
t.Run("SendReliable", func(t *testing.T) {
cluster, cleanup := makeCluster(t)
Expand All @@ -174,7 +175,7 @@ func TestTCPTransport(t *testing.T) {
require.NoError(t, err)

util.Pause(time.Second)
require.Len(t, cluster.delegates[1].Msgs, 1)
require.Len(t, cluster.delegates[1].Messages(), 1)
})
}

Expand Down Expand Up @@ -278,7 +279,8 @@ type mockCluster struct {
}

type delegate struct {
Msgs [][]byte
sync.Mutex
messages [][]byte
}

// nolint
Expand All @@ -288,7 +290,15 @@ func (d *delegate) NodeMeta(limit int) []byte {

// nolint
func (d *delegate) NotifyMsg(m []byte) {
d.Msgs = append(d.Msgs, m)
d.Lock()
defer d.Unlock()
d.messages = append(d.messages, m)
}

func (d *delegate) Messages() [][]byte {
d.Lock()
defer d.Unlock()
return d.messages
}

// nolint
Expand Down

0 comments on commit f970339

Please sign in to comment.