Merge branch 'master' into feature/add_context_support

pull/480/head
shirou 7 years ago committed by GitHub
commit a97abd3450
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4,8 +4,6 @@ package docker
import ( import (
"context" "context"
"encoding/json"
"github.com/shirou/gopsutil/cpu" "github.com/shirou/gopsutil/cpu"
"github.com/shirou/gopsutil/internal/common" "github.com/shirou/gopsutil/internal/common"
) )
@ -65,8 +63,3 @@ func CgroupMemDocker(containerid string) (*CgroupMemStat, error) {
func CgroupMemDockerWithContext(ctx context.Context, containerid string) (*CgroupMemStat, error) { func CgroupMemDockerWithContext(ctx context.Context, containerid string) (*CgroupMemStat, error) {
return CgroupMem(containerid, common.HostSys("fs/cgroup/memory/docker")) return CgroupMem(containerid, common.HostSys("fs/cgroup/memory/docker"))
} }
func (m CgroupMemStat) String() string {
s, _ := json.Marshal(m)
return string(s)
}

@ -2,6 +2,7 @@ package host
import ( import (
"fmt" "fmt"
"os"
"testing" "testing"
) )
@ -20,6 +21,10 @@ func TestHostInfo(t *testing.T) {
} }
func TestUptime(t *testing.T) { func TestUptime(t *testing.T) {
if os.Getenv("CIRCLECI") == "true" {
t.Skip("Skip CI")
}
v, err := Uptime() v, err := Uptime()
if err != nil { if err != nil {
t.Errorf("error %v", err) t.Errorf("error %v", err)
@ -30,6 +35,9 @@ func TestUptime(t *testing.T) {
} }
func TestBoot_time(t *testing.T) { func TestBoot_time(t *testing.T) {
if os.Getenv("CIRCLECI") == "true" {
t.Skip("Skip CI")
}
v, err := BootTime() v, err := BootTime()
if err != nil { if err != nil {
t.Errorf("error %v", err) t.Errorf("error %v", err)

@ -301,6 +301,10 @@ func Test_Process_CpuPercentLoop(t *testing.T) {
} }
func Test_Process_CreateTime(t *testing.T) { func Test_Process_CreateTime(t *testing.T) {
if os.Getenv("CIRCLECI") == "true" {
t.Skip("Skip CI")
}
p := testGetProcess() p := testGetProcess()
c, err := p.CreateTime() c, err := p.CreateTime()

Loading…
Cancel
Save