mirror of
https://github.com/weaveworks/scope.git
synced 2026-05-05 16:59:36 +00:00
23 lines
390 B
Go
23 lines
390 B
Go
package linux
|
|
|
|
import "testing"
|
|
|
|
func TestUptime(t *testing.T) {
|
|
|
|
uptime, err := ReadUptime("proc/uptime")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if uptime.Total == 0 {
|
|
t.Fatal("uptime total read fail")
|
|
}
|
|
if uptime.Idle == 0 {
|
|
t.Fatal("uptime idel read fail")
|
|
}
|
|
|
|
t.Logf("Total: %+v", uptime.GetTotalDuration())
|
|
t.Logf("Idle: %+v", uptime.GetIdleDuration())
|
|
|
|
t.Logf("%+v", uptime)
|
|
}
|