Reduce test logs (#2550)

This commit is contained in:
Maycon Santos 2024-09-06 16:28:19 +02:00 committed by GitHub
parent fcf150f704
commit a7e46bf7b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 33 additions and 27 deletions

View File

@ -1272,11 +1272,12 @@ func initTestRouteAccount(t *testing.T, am *DefaultAccountManager) (*Account, er
} }
peer1 := &nbpeer.Peer{ peer1 := &nbpeer.Peer{
IP: peer1IP, IP: peer1IP,
ID: peer1ID, ID: peer1ID,
Key: peer1Key, Key: peer1Key,
Name: "test-host1@netbird.io", Name: "test-host1@netbird.io",
UserID: userID, DNSLabel: "test-host1",
UserID: userID,
Meta: nbpeer.PeerSystemMeta{ Meta: nbpeer.PeerSystemMeta{
Hostname: "test-host1@netbird.io", Hostname: "test-host1@netbird.io",
GoOS: "linux", GoOS: "linux",
@ -1298,11 +1299,12 @@ func initTestRouteAccount(t *testing.T, am *DefaultAccountManager) (*Account, er
} }
peer2 := &nbpeer.Peer{ peer2 := &nbpeer.Peer{
IP: peer2IP, IP: peer2IP,
ID: peer2ID, ID: peer2ID,
Key: peer2Key, Key: peer2Key,
Name: "test-host2@netbird.io", Name: "test-host2@netbird.io",
UserID: userID, DNSLabel: "test-host2",
UserID: userID,
Meta: nbpeer.PeerSystemMeta{ Meta: nbpeer.PeerSystemMeta{
Hostname: "test-host2@netbird.io", Hostname: "test-host2@netbird.io",
GoOS: "linux", GoOS: "linux",
@ -1324,11 +1326,12 @@ func initTestRouteAccount(t *testing.T, am *DefaultAccountManager) (*Account, er
} }
peer3 := &nbpeer.Peer{ peer3 := &nbpeer.Peer{
IP: peer3IP, IP: peer3IP,
ID: peer3ID, ID: peer3ID,
Key: peer3Key, Key: peer3Key,
Name: "test-host3@netbird.io", Name: "test-host3@netbird.io",
UserID: userID, DNSLabel: "test-host3",
UserID: userID,
Meta: nbpeer.PeerSystemMeta{ Meta: nbpeer.PeerSystemMeta{
Hostname: "test-host3@netbird.io", Hostname: "test-host3@netbird.io",
GoOS: "darwin", GoOS: "darwin",
@ -1350,11 +1353,12 @@ func initTestRouteAccount(t *testing.T, am *DefaultAccountManager) (*Account, er
} }
peer4 := &nbpeer.Peer{ peer4 := &nbpeer.Peer{
IP: peer4IP, IP: peer4IP,
ID: peer4ID, ID: peer4ID,
Key: peer4Key, Key: peer4Key,
Name: "test-host4@netbird.io", Name: "test-host4@netbird.io",
UserID: userID, DNSLabel: "test-host4",
UserID: userID,
Meta: nbpeer.PeerSystemMeta{ Meta: nbpeer.PeerSystemMeta{
Hostname: "test-host4@netbird.io", Hostname: "test-host4@netbird.io",
GoOS: "linux", GoOS: "linux",
@ -1376,13 +1380,14 @@ func initTestRouteAccount(t *testing.T, am *DefaultAccountManager) (*Account, er
} }
peer5 := &nbpeer.Peer{ peer5 := &nbpeer.Peer{
IP: peer5IP, IP: peer5IP,
ID: peer5ID, ID: peer5ID,
Key: peer5Key, Key: peer5Key,
Name: "test-host4@netbird.io", Name: "test-host5@netbird.io",
UserID: userID, DNSLabel: "test-host5",
UserID: userID,
Meta: nbpeer.PeerSystemMeta{ Meta: nbpeer.PeerSystemMeta{
Hostname: "test-host4@netbird.io", Hostname: "test-host5@netbird.io",
GoOS: "linux", GoOS: "linux",
Kernel: "Linux", Kernel: "Linux",
Core: "21.04", Core: "21.04",

View File

@ -63,6 +63,7 @@ func TestScheduler_Cancel(t *testing.T) {
scheduler.Schedule(context.Background(), scheduletime, jobID2, func() (nextRunIn time.Duration, reschedule bool) { scheduler.Schedule(context.Background(), scheduletime, jobID2, func() (nextRunIn time.Duration, reschedule bool) {
return scheduletime, true return scheduletime, true
}) })
defer scheduler.Cancel(context.Background(), []string{jobID2})
time.Sleep(sleepTime) time.Sleep(sleepTime)
assert.Len(t, scheduler.jobs, 2) assert.Len(t, scheduler.jobs, 2)

View File

@ -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) log.WithContext(ctx).Debugf("update was sent to channel for peer %s", peerID)
default: default:
dropped = true 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 { } else {
log.WithContext(ctx).Debugf("peer %s has no channel", peerID) log.WithContext(ctx).Debugf("peer %s has no channel", peerID)