forked from TrueCloudLab/frostfs-node
a97dee008c
The lowest value means the highest priority. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
29 lines
460 B
Go
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
|
|
}
|
|
}
|