Evgenii Stratonikov
d641cba2fc
Some checks failed
Build / Build Components (1.20) (pull_request) Failing after 3s
Build / Build Components (1.21) (pull_request) Failing after 3s
Tests and linters / Lint (pull_request) Failing after 3s
Tests and linters / Tests (1.20) (pull_request) Failing after 3s
Tests and linters / Tests (1.21) (pull_request) Failing after 3s
Tests and linters / Tests with -race (pull_request) Failing after 5s
Tests and linters / Staticcheck (pull_request) Failing after 8s
Vulncheck / Vulncheck (pull_request) Failing after 2s
Fix staticcheck warnings after go1.20 update. Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
29 lines
477 B
Go
29 lines
477 B
Go
package client
|
|
|
|
import (
|
|
"math/rand"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestInitEndpoints(t *testing.T) {
|
|
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
|
|
ee := make([]Endpoint, 100)
|
|
for i := range ee {
|
|
ee[i].Priority = r.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
|
|
}
|
|
}
|