add check if it runs on CI

This commit is contained in:
shirou 2021-05-08 22:31:05 +09:00
parent c6bd05a3e9
commit 3d97fc18f4
2 changed files with 12 additions and 4 deletions

View File

@ -89,8 +89,12 @@ func TestNetIOCountersAll(t *testing.T) {
}
// small diff is ok
if math.Abs(float64(v[0].PacketsRecv-pr)) > 5 {
// This test often fails in CI. so just print even if failed
fmt.Printf("invalid sum value: %v, %v", v[0].PacketsRecv, pr)
if ci := os.Getenv("CI"); ci != "" {
// This test often fails in CI. so just print even if failed.
fmt.Printf("invalid sum value: %v, %v", v[0].PacketsRecv, pr)
} else {
t.Errorf("invalid sum value: %v, %v", v[0].PacketsRecv, pr)
}
}
}

View File

@ -89,8 +89,12 @@ func TestNetIOCountersAll(t *testing.T) {
}
// small diff is ok
if math.Abs(float64(v[0].PacketsRecv-pr)) > 5 {
// This test often fails in CI. so just print even if failed
fmt.Printf("invalid sum value: %v, %v", v[0].PacketsRecv, pr)
if ci := os.Getenv("CI"); ci != "" {
// This test often fails in CI. so just print even if failed.
fmt.Printf("invalid sum value: %v, %v", v[0].PacketsRecv, pr)
} else {
t.Errorf("invalid sum value: %v, %v", v[0].PacketsRecv, pr)
}
}
}