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()
|
|
|
|
|
2023-06-29 09:13:01 +00:00
|
|
|
require.Equal(t, cache.processStatus(node), nodeNotProcessed)
|
2022-10-07 09:19:31 +00:00
|
|
|
|
2022-10-07 09:26:08 +00:00
|
|
|
cache.SubmitSuccessfulReplication(node)
|
2023-06-29 09:13:01 +00:00
|
|
|
require.Equal(t, cache.processStatus(node), nodeHoldsObject)
|
2022-10-07 09:19:31 +00:00
|
|
|
|
|
|
|
cache.submitReplicaCandidate(node)
|
2023-06-29 09:13:01 +00:00
|
|
|
require.Equal(t, cache.processStatus(node), nodeDoesNotHoldObject)
|
2022-10-07 09:19:31 +00:00
|
|
|
|
|
|
|
cache.submitReplicaHolder(node)
|
2023-06-29 09:13:01 +00:00
|
|
|
require.Equal(t, cache.processStatus(node), nodeHoldsObject)
|
2022-10-07 09:19:31 +00:00
|
|
|
}
|