From a7e46bf7b18df9fbfe3e46ae615b9bd38377bb18 Mon Sep 17 00:00:00 2001 From: Maycon Santos Date: Fri, 6 Sep 2024 16:28:19 +0200 Subject: [PATCH] Reduce test logs (#2550) --- management/server/route_test.go | 57 ++++++++++++++++------------- management/server/scheduler_test.go | 1 + management/server/updatechannel.go | 2 +- 3 files changed, 33 insertions(+), 27 deletions(-) diff --git a/management/server/route_test.go b/management/server/route_test.go index 47dc4d078..506bfb0a8 100644 --- a/management/server/route_test.go +++ b/management/server/route_test.go @@ -1272,11 +1272,12 @@ func initTestRouteAccount(t *testing.T, am *DefaultAccountManager) (*Account, er } peer1 := &nbpeer.Peer{ - IP: peer1IP, - ID: peer1ID, - Key: peer1Key, - Name: "test-host1@netbird.io", - UserID: userID, + IP: peer1IP, + ID: peer1ID, + Key: peer1Key, + Name: "test-host1@netbird.io", + DNSLabel: "test-host1", + UserID: userID, Meta: nbpeer.PeerSystemMeta{ Hostname: "test-host1@netbird.io", GoOS: "linux", @@ -1298,11 +1299,12 @@ func initTestRouteAccount(t *testing.T, am *DefaultAccountManager) (*Account, er } peer2 := &nbpeer.Peer{ - IP: peer2IP, - ID: peer2ID, - Key: peer2Key, - Name: "test-host2@netbird.io", - UserID: userID, + IP: peer2IP, + ID: peer2ID, + Key: peer2Key, + Name: "test-host2@netbird.io", + DNSLabel: "test-host2", + UserID: userID, Meta: nbpeer.PeerSystemMeta{ Hostname: "test-host2@netbird.io", GoOS: "linux", @@ -1324,11 +1326,12 @@ func initTestRouteAccount(t *testing.T, am *DefaultAccountManager) (*Account, er } peer3 := &nbpeer.Peer{ - IP: peer3IP, - ID: peer3ID, - Key: peer3Key, - Name: "test-host3@netbird.io", - UserID: userID, + IP: peer3IP, + ID: peer3ID, + Key: peer3Key, + Name: "test-host3@netbird.io", + DNSLabel: "test-host3", + UserID: userID, Meta: nbpeer.PeerSystemMeta{ Hostname: "test-host3@netbird.io", GoOS: "darwin", @@ -1350,11 +1353,12 @@ func initTestRouteAccount(t *testing.T, am *DefaultAccountManager) (*Account, er } peer4 := &nbpeer.Peer{ - IP: peer4IP, - ID: peer4ID, - Key: peer4Key, - Name: "test-host4@netbird.io", - UserID: userID, + IP: peer4IP, + ID: peer4ID, + Key: peer4Key, + Name: "test-host4@netbird.io", + DNSLabel: "test-host4", + UserID: userID, Meta: nbpeer.PeerSystemMeta{ Hostname: "test-host4@netbird.io", GoOS: "linux", @@ -1376,13 +1380,14 @@ func initTestRouteAccount(t *testing.T, am *DefaultAccountManager) (*Account, er } peer5 := &nbpeer.Peer{ - IP: peer5IP, - ID: peer5ID, - Key: peer5Key, - Name: "test-host4@netbird.io", - UserID: userID, + IP: peer5IP, + ID: peer5ID, + Key: peer5Key, + Name: "test-host5@netbird.io", + DNSLabel: "test-host5", + UserID: userID, Meta: nbpeer.PeerSystemMeta{ - Hostname: "test-host4@netbird.io", + Hostname: "test-host5@netbird.io", GoOS: "linux", Kernel: "Linux", Core: "21.04", diff --git a/management/server/scheduler_test.go b/management/server/scheduler_test.go index 7c287a554..fa279d4db 100644 --- a/management/server/scheduler_test.go +++ b/management/server/scheduler_test.go @@ -63,6 +63,7 @@ func TestScheduler_Cancel(t *testing.T) { scheduler.Schedule(context.Background(), scheduletime, jobID2, func() (nextRunIn time.Duration, reschedule bool) { return scheduletime, true }) + defer scheduler.Cancel(context.Background(), []string{jobID2}) time.Sleep(sleepTime) assert.Len(t, scheduler.jobs, 2) diff --git a/management/server/updatechannel.go b/management/server/updatechannel.go index c11225dbc..0188cef52 100644 --- a/management/server/updatechannel.go +++ b/management/server/updatechannel.go @@ -55,7 +55,7 @@ func (p *PeersUpdateManager) SendUpdate(ctx context.Context, peerID string, upda log.WithContext(ctx).Debugf("update was sent to channel for peer %s", peerID) default: dropped = true - log.WithContext(ctx).Warnf("channel for peer %s is %d full", peerID, len(channel)) + log.WithContext(ctx).Warnf("channel for peer %s is %d full or closed", peerID, len(channel)) } } else { log.WithContext(ctx).Debugf("peer %s has no channel", peerID)