2022-10-07 09:19:31 +00:00
|
|
|
package policer
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2022-12-23 17:35:35 +00:00
|
|
|
netmaptest "github.com/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))
|
|
|
|
}
|