/usr/share/gocode/src/github.com/shirou/gopsutil/load/load_test.go is in golang-github-shirou-gopsutil-dev 2.17.08-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | package load
import (
"fmt"
"testing"
)
func TestLoad(t *testing.T) {
v, err := Avg()
if err != nil {
t.Errorf("error %v", err)
}
empty := &AvgStat{}
if v == empty {
t.Errorf("error load: %v", v)
}
}
func TestLoadAvgStat_String(t *testing.T) {
v := AvgStat{
Load1: 10.1,
Load5: 20.1,
Load15: 30.1,
}
e := `{"load1":10.1,"load5":20.1,"load15":30.1}`
if e != fmt.Sprintf("%v", v) {
t.Errorf("LoadAvgStat string is invalid: %v", v)
}
}
func TestMisc(t *testing.T) {
v, err := Misc()
if err != nil {
t.Errorf("error %v", err)
}
empty := &MiscStat{}
if v == empty {
t.Errorf("error load: %v", v)
}
}
func TestMiscStatString(t *testing.T) {
v := MiscStat{
ProcsRunning: 1,
ProcsBlocked: 2,
Ctxt: 3,
}
e := `{"procsRunning":1,"procsBlocked":2,"ctxt":3}`
if e != fmt.Sprintf("%v", v) {
t.Errorf("TestMiscString string is invalid: %v", v)
}
}
|