frostfs-node/pkg/morph/client/multy_test.go
Pavel Karpy a97dee008c [] morph: Change endpoint priority order
The lowest value means the highest priority.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-08-04 16:11:24 +03:00

29 lines
460 B
Go

package client
import (
"math/rand"
"testing"
"time"
"github.com/stretchr/testify/require"
)
func TestInitEndpoints(t *testing.T) {
rand.Seed(time.Now().UnixNano())
ee := make([]Endpoint, 100)
for i := range ee {
ee[i].Priority = rand.Int()
}
var eeInternal endpoints
eeInternal.init(ee)
prevValue := eeInternal.list[0].Priority
for _, e := range eeInternal.list {
require.True(t, prevValue <= e.Priority)
prevValue = e.Priority
}
}