CPU num is different on the CircleCI environemnt, so we skip it.

This commit is contained in:
Shirou WAKAYAMA 2016-02-12 22:44:17 +09:00
parent c54ae65e78
commit 7f22150707
1 changed files with 6 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package cpu
import (
"fmt"
"os"
"runtime"
"testing"
"time"
@ -71,10 +72,13 @@ func testCPUPercent(t *testing.T, percpu bool) {
if err != nil {
t.Errorf("error %v", err)
}
// Skip CircleCI which CPU num is different
if os.Getenv("CIRCLECI") != "true" {
if (percpu && len(v) != numcpu) || (!percpu && len(v) != 1) {
t.Fatalf("wrong number of entries from CPUPercent: %v", v)
}
}
}
for i := 0; i < testCount; i++ {
duration := time.Duration(10) * time.Microsecond
v, err := CPUPercent(duration, percpu)