From 31a5e4f095ca024927104cf78593acbe651bb0f4 Mon Sep 17 00:00:00 2001 From: zhsj Date: Wed, 12 Feb 2020 00:59:17 +0800 Subject: [PATCH] Skip TestTopology on non-amd64 (#2391) * Skip TestTopology tests on unsupported platforms --- machine/topology_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/machine/topology_test.go b/machine/topology_test.go index 2f40d5e0..ceecf926 100644 --- a/machine/topology_test.go +++ b/machine/topology_test.go @@ -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.")