1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-09 17:44:59 +09:00

GO-3171: fix tests and lint

Signed-off-by: AnastasiaShemyakinskaya <shem98a@mail.ru>
This commit is contained in:
AnastasiaShemyakinskaya 2024-07-03 10:16:23 +02:00
parent 22174a324f
commit 1c5c10e1ea
No known key found for this signature in database
GPG key ID: CCD60ED83B103281
2 changed files with 4 additions and 6 deletions

View file

@ -19,7 +19,6 @@ import (
"go.uber.org/zap"
"github.com/anyproto/anytype-heart/core/anytype/config"
"github.com/anyproto/anytype-heart/core/event"
"github.com/anyproto/anytype-heart/net/addrs"
"github.com/anyproto/anytype-heart/space/spacecore/clientserver"
)
@ -54,7 +53,6 @@ type localDiscovery struct {
started bool
notifier Notifier
m sync.Mutex
eventSender event.Sender
hookMu sync.Mutex
hooks map[Hook][]HookCallback
@ -74,7 +72,6 @@ func (l *localDiscovery) Init(a *app.App) (err error) {
l.peerId = a.MustComponent(accountservice.CName).(accountservice.Service).Account().PeerId
l.periodicCheck = periodicsync.NewPeriodicSync(10, 0, l.checkAddrs, log)
l.drpcServer = app.MustComponent[clientserver.ClientServer](a)
l.eventSender = app.MustComponent[event.Sender](a)
return
}

View file

@ -2,6 +2,7 @@ package localdiscovery
import (
"context"
"sync/atomic"
"testing"
"github.com/anyproto/any-sync/accountservice/mock_accountservice"
@ -97,16 +98,16 @@ func TestLocalDiscovery_checkAddrs(t *testing.T) {
// when
ld := f.LocalDiscovery.(*localDiscovery)
var hookCalled bool
var hookCalled atomic.Bool
ld.RegisterResetNotPossible(func() {
hookCalled = true
hookCalled.Store(true)
})
ld.port = 6789
err := ld.checkAddrs(context.Background())
// then
assert.Nil(t, err)
assert.True(t, hookCalled)
assert.True(t, hookCalled.Load())
})
}