cpu_test.go 539 B

1234567891011121314151617181920212223242526272829
  1. package node
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/assert"
  5. )
  6. func TestNode_cpu(t *testing.T) {
  7. usage, err := cpuStat("fixtures/proc")
  8. assert.Nil(t, err)
  9. //cpu 22246621850 266246696 6211649668 51164293943 1715028476 0 3050509822 0 0 0
  10. assert.Equal(t,
  11. CpuStat{
  12. TotalUsage: CpuUsage{
  13. User: 222466218.50,
  14. Nice: 2662466.96,
  15. System: 62116496.68,
  16. Idle: 511642939.43,
  17. IoWait: 17150284.76,
  18. Irq: 0,
  19. SoftIrq: 30505098.22,
  20. Steal: 0,
  21. },
  22. LogicalCores: 16,
  23. },
  24. usage)
  25. }