Browse Source

fix test case

pull/844/head
bingoohuang 7 years ago
parent
commit
b03ae344b0
  1. 17
      weed/storage/sysstat_test.go

17
weed/storage/sysstat_test.go

@ -2,13 +2,14 @@ package storage
import (
"fmt"
"github.com/stretchr/testify/assert"
"testing"
)
func TestMemoryStat(t *testing.T) {
total, free, err := MemoryStat()
assert.Nil(t, err)
if err != nil {
t.Fail()
}
if total <= 0 {
println("total", total, "free", free)
@ -18,7 +19,9 @@ func TestMemoryStat(t *testing.T) {
func TestDiskStat(t *testing.T) {
total, free, device, mountPoint, err := DiskStat("..")
assert.Nil(t, err)
if err != nil {
t.Fail()
}
if total <= 0 {
println("total", total, "free", free)
@ -31,7 +34,9 @@ func TestDiskStat(t *testing.T) {
func TestAvgLoad(t *testing.T) {
load1, load5, load15, err := LoadStat()
assert.Nil(t, err)
if err != nil {
t.Fail()
}
if load1 <= 0 {
println("load1", load1, "load5", load5, "load15", load15)
@ -41,7 +46,9 @@ func TestAvgLoad(t *testing.T) {
func TestProcessStat(t *testing.T) {
name, cpuUsage, rss, err := ProcessStat()
assert.Nil(t, err)
if err != nil {
t.Fail()
}
if rss <= 0 {
println("name", name, "cpuUsage", cpuUsage, "RSS", rss)

Loading…
Cancel
Save