Merge pull request #2558 from AlexeyPerevalov/socket_id

Fix test with different order of Topology's nodes
This commit is contained in:
David Ashpole 2020-05-26 15:26:18 -07:00 committed by GitHub
commit 107e5aa4c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,6 +19,7 @@ import (
"io/ioutil"
"os"
"reflect"
"sort"
"testing"
info "github.com/google/cadvisor/info/v1"
@ -263,6 +264,9 @@ func TestTopologyWithoutNodes(t *testing.T) {
sysFs.SetPhysicalPackageIDs(physicalPackageIDs, nil)
topology, numCores, err := GetTopology(sysFs)
sort.SliceStable(topology, func(i, j int) bool {
return topology[i].Id < topology[j].Id
})
assert.Nil(t, err)
assert.Equal(t, 2, len(topology))
assert.Equal(t, 4, numCores)