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:
parent
22174a324f
commit
1c5c10e1ea
2 changed files with 4 additions and 6 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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())
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue