2022-10-07 09:19:31 +00:00
|
|
|
package policer
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2023-03-07 13:38:26 +00:00
|
|
|
netmaptest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap/test"
|
2022-10-07 09:19:31 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestNodeCache(t *testing.T) {
|
|
|
|
cache := newNodeCache()
|
|
|
|
node := netmaptest.NodeInfo()
|
|
|
|
|
|
|
|
require.Negative(t, cache.processStatus(node))
|
|
|
|
|
2022-10-07 09:26:08 +00:00
|
|
|
cache.SubmitSuccessfulReplication(node)
|
2022-10-07 09:19:31 +00:00
|
|
|
require.Zero(t, cache.processStatus(node))
|
|
|
|
|
|
|
|
cache.submitReplicaCandidate(node)
|
|
|
|
require.Positive(t, cache.processStatus(node))
|
|
|
|
|
|
|
|
cache.submitReplicaHolder(node)
|
|
|
|
require.Zero(t, cache.processStatus(node))
|
|
|
|
}
|