Skip TestTopology on non-amd64 (#2391)

* Skip TestTopology tests on unsupported platforms
This commit is contained in:
zhsj 2020-02-12 00:59:17 +08:00 committed by GitHub
parent f1ef936cc3
commit 31a5e4f095
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,7 @@ package machine
import (
"io/ioutil"
"reflect"
"runtime"
"testing"
info "github.com/google/cadvisor/info/v1"
@ -25,6 +26,9 @@ import (
)
func TestTopology(t *testing.T) {
if runtime.GOARCH != "amd64" {
t.Skip("cpuinfo testdata is for amd64")
}
testfile := "./testdata/cpuinfo"
testcpuinfo, err := ioutil.ReadFile(testfile)
if err != nil {
@ -78,6 +82,9 @@ func TestTopology(t *testing.T) {
}
func TestTopologyWithSimpleCpuinfo(t *testing.T) {
if isSystemZ() {
t.Skip("systemZ has no topology info")
}
sysFs := &fakesysfs.FakeSysFs{}
c := sysfs.CacheInfo{
Size: 32 * 1024,
@ -114,6 +121,9 @@ func TestTopologyWithSimpleCpuinfo(t *testing.T) {
}
func TestTopologyEmptyCpuinfo(t *testing.T) {
if isSystemZ() {
t.Skip("systemZ has no topology info")
}
_, _, err := GetTopology(&fakesysfs.FakeSysFs{}, "")
if err == nil {
t.Errorf("Expected empty cpuinfo to fail.")