You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

50 lines
873 B

package storage
import (
"fmt"
"github.com/stretchr/testify/assert"
"testing"
)
func TestMemoryStat(t *testing.T) {
total, free, err := MemoryStat()
assert.Nil(t, err)
if total <= 0 {
println("total", total, "free", free)
t.Fail()
}
}
func TestDiskStat(t *testing.T) {
total, free, device, mountPoint, err := DiskStat("..")
assert.Nil(t, err)
if total <= 0 {
println("total", total, "free", free)
t.Fail()
}
fmt.Println("device", device, "mountPoint", mountPoint)
}
func TestAvgLoad(t *testing.T) {
load1, load5, load15, err := LoadStat()
assert.Nil(t, err)
if load1 <= 0 {
println("load1", load1, "load5", load5, "load15", load15)
t.Fail()
}
}
func TestProcessStat(t *testing.T) {
name, cpuUsage, rss, err := ProcessStat()
assert.Nil(t, err)
if rss <= 0 {
println("name", name, "cpuUsage", cpuUsage, "RSS", rss)
t.Fail()
}
}