Skip to content

Commit

Permalink
[MM-61100] Fix errcheck issues in server/channels/app/busy_test.go (m…
Browse files Browse the repository at this point in the history
  • Loading branch information
RS-labhub authored Nov 5, 2024
1 parent d3c18ee commit 6b5732a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 0 additions & 1 deletion server/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ issues:
channels/app/auto_responder_test.go|\
channels/app/bot_test.go|\
channels/app/brand.go|\
channels/app/busy_test.go|\
channels/app/channel.go|\
channels/app/channel_bookmark_test.go|\
channels/app/channel_test.go|\
Expand Down
10 changes: 6 additions & 4 deletions server/channels/app/busy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
)

func TestBusySet(t *testing.T) {
cluster := &ClusterMock{Busy: &Busy{}}
cluster := &ClusterMock{Busy: &Busy{}, t: t}
busy := NewBusy(cluster)

isNotBusy := func() bool {
Expand Down Expand Up @@ -54,7 +54,7 @@ func TestBusySet(t *testing.T) {
}

func TestBusyExpires(t *testing.T) {
cluster := &ClusterMock{Busy: &Busy{}}
cluster := &ClusterMock{Busy: &Busy{}, t: t}
busy := NewBusy(cluster)

isNotBusy := func() bool {
Expand Down Expand Up @@ -90,7 +90,7 @@ func TestBusyExpires(t *testing.T) {
}

func TestBusyRace(t *testing.T) {
cluster := &ClusterMock{Busy: &Busy{}}
cluster := &ClusterMock{Busy: &Busy{}, t: t}
busy := NewBusy(cluster)

busy.Set(500 * time.Millisecond)
Expand Down Expand Up @@ -119,11 +119,13 @@ func compareBusyState(t *testing.T, busy1 *Busy, busy2 *Busy) bool {
// ClusterMock simulates the busy state of a cluster.
type ClusterMock struct {
Busy *Busy
t *testing.T
}

func (c *ClusterMock) SendClusterMessage(msg *model.ClusterMessage) {
var sbs model.ServerBusyState
json.Unmarshal(msg.Data, &sbs)
err := json.Unmarshal(msg.Data, &sbs)
require.NoError(c.t, err)
c.Busy.ClusterEventChanged(&sbs)
}

Expand Down

0 comments on commit 6b5732a

Please sign in to comment.