From 1958326a49959d5b31e3a86483c12b394da1950e Mon Sep 17 00:00:00 2001 From: shirou Date: Tue, 9 Jan 2018 11:21:13 +0900 Subject: [PATCH 1/2] [docker]: fix re-declartion --- docker/docker_notlinux.go | 7 ------- 1 file changed, 7 deletions(-) diff --git a/docker/docker_notlinux.go b/docker/docker_notlinux.go index f78fb33..e403dbb 100644 --- a/docker/docker_notlinux.go +++ b/docker/docker_notlinux.go @@ -3,8 +3,6 @@ package docker import ( - "encoding/json" - "github.com/shirou/gopsutil/cpu" "github.com/shirou/gopsutil/internal/common" ) @@ -40,8 +38,3 @@ func CgroupMem(containerid string, base string) (*CgroupMemStat, error) { func CgroupMemDocker(containerid string) (*CgroupMemStat, error) { return CgroupMem(containerid, common.HostSys("fs/cgroup/memory/docker")) } - -func (m CgroupMemStat) String() string { - s, _ := json.Marshal(m) - return string(s) -} From d1fb05a30bd0d38b2e56ca3cdf04b0cd30ba2083 Mon Sep 17 00:00:00 2001 From: shirou Date: Tue, 9 Jan 2018 11:30:38 +0900 Subject: [PATCH 2/2] Skip some test if CircleCI. --- host/host_test.go | 8 ++++++++ process/process_test.go | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/host/host_test.go b/host/host_test.go index 87a6bd9..b4f3e40 100644 --- a/host/host_test.go +++ b/host/host_test.go @@ -2,6 +2,7 @@ package host import ( "fmt" + "os" "testing" ) @@ -20,6 +21,10 @@ func TestHostInfo(t *testing.T) { } func TestUptime(t *testing.T) { + if os.Getenv("CIRCLECI") == "true" { + t.Skip("Skip CI") + } + v, err := Uptime() if err != nil { t.Errorf("error %v", err) @@ -30,6 +35,9 @@ func TestUptime(t *testing.T) { } func TestBoot_time(t *testing.T) { + if os.Getenv("CIRCLECI") == "true" { + t.Skip("Skip CI") + } v, err := BootTime() if err != nil { t.Errorf("error %v", err) diff --git a/process/process_test.go b/process/process_test.go index 84c24bd..d8eb483 100644 --- a/process/process_test.go +++ b/process/process_test.go @@ -301,6 +301,10 @@ func Test_Process_CpuPercentLoop(t *testing.T) { } func Test_Process_CreateTime(t *testing.T) { + if os.Getenv("CIRCLECI") == "true" { + t.Skip("Skip CI") + } + p := testGetProcess() c, err := p.CreateTime()