frostfs-node/pkg/services/policer/check_test.go
Leonard Lyubich df5d7bf729 [#1680] replicator: Work with netmap.NodeInfo in TaskResult
Make `replicator.TaskResult` to accept `netmap.NodeInfo` type instead of
uint64 in order to clarify the meaning and prevent passing the random
numbers.

Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
2022-10-11 12:54:27 +03:00

24 lines
531 B
Go

package policer
import (
"testing"
netmaptest "github.com/nspcc-dev/neofs-sdk-go/netmap/test"
"github.com/stretchr/testify/require"
)
func TestNodeCache(t *testing.T) {
cache := newNodeCache()
node := netmaptest.NodeInfo()
require.Negative(t, cache.processStatus(node))
cache.SubmitSuccessfulReplication(node)
require.Zero(t, cache.processStatus(node))
cache.submitReplicaCandidate(node)
require.Positive(t, cache.processStatus(node))
cache.submitReplicaHolder(node)
require.Zero(t, cache.processStatus(node))
}