From 6b5732a6af31477da6c6e4ca33ddc9c97476ab21 Mon Sep 17 00:00:00 2001 From: Rohan Sharma <117426013+RS-labhub@users.noreply.github.com> Date: Tue, 5 Nov 2024 23:47:22 +0530 Subject: [PATCH] [MM-61100] Fix errcheck issues in server/channels/app/busy_test.go (#28786) --- server/.golangci.yml | 1 - server/channels/app/busy_test.go | 10 ++++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/server/.golangci.yml b/server/.golangci.yml index f119e885e2..0502c52261 100644 --- a/server/.golangci.yml +++ b/server/.golangci.yml @@ -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|\ diff --git a/server/channels/app/busy_test.go b/server/channels/app/busy_test.go index 16d445ab2c..380820b4d0 100644 --- a/server/channels/app/busy_test.go +++ b/server/channels/app/busy_test.go @@ -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 { @@ -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 { @@ -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) @@ -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) }