Fix CPU unit tests for time_ prefix

This commit is contained in:
Cameron Sparr 2015-09-21 17:08:50 -07:00
parent b012713cf2
commit b8a58dad65
1 changed files with 20 additions and 20 deletions

View File

@ -133,16 +133,16 @@ func TestSystemStats_GenerateStats(t *testing.T) {
// Computed values are checked with delta > 0 becasue of floating point arithmatic // Computed values are checked with delta > 0 becasue of floating point arithmatic
// imprecision // imprecision
assertContainsTaggedFloat(t, acc, "user", 3.1, 0, cputags) assertContainsTaggedFloat(t, acc, "time_user", 3.1, 0, cputags)
assertContainsTaggedFloat(t, acc, "system", 8.2, 0, cputags) assertContainsTaggedFloat(t, acc, "time_system", 8.2, 0, cputags)
assertContainsTaggedFloat(t, acc, "idle", 80.1, 0, cputags) assertContainsTaggedFloat(t, acc, "time_idle", 80.1, 0, cputags)
assertContainsTaggedFloat(t, acc, "nice", 1.3, 0, cputags) assertContainsTaggedFloat(t, acc, "time_nice", 1.3, 0, cputags)
assertContainsTaggedFloat(t, acc, "iowait", 0.2, 0, cputags) assertContainsTaggedFloat(t, acc, "time_iowait", 0.2, 0, cputags)
assertContainsTaggedFloat(t, acc, "irq", 0.1, 0, cputags) assertContainsTaggedFloat(t, acc, "time_irq", 0.1, 0, cputags)
assertContainsTaggedFloat(t, acc, "softirq", 0.11, 0, cputags) assertContainsTaggedFloat(t, acc, "time_softirq", 0.11, 0, cputags)
assertContainsTaggedFloat(t, acc, "steal", 0.0511, 0, cputags) assertContainsTaggedFloat(t, acc, "time_steal", 0.0511, 0, cputags)
assertContainsTaggedFloat(t, acc, "guest", 8.1, 0, cputags) assertContainsTaggedFloat(t, acc, "time_guest", 8.1, 0, cputags)
assertContainsTaggedFloat(t, acc, "guest_nice", 0.324, 0, cputags) assertContainsTaggedFloat(t, acc, "time_guest_nice", 0.324, 0, cputags)
mps2 := MockPS{} mps2 := MockPS{}
mps2.On("CPUTimes").Return([]cpu.CPUTimesStat{cts2}, nil) mps2.On("CPUTimes").Return([]cpu.CPUTimesStat{cts2}, nil)
@ -156,16 +156,16 @@ func TestSystemStats_GenerateStats(t *testing.T) {
expectedCPUPoints = 20 expectedCPUPoints = 20
assert.Equal(t, numCPUPoints, expectedCPUPoints) assert.Equal(t, numCPUPoints, expectedCPUPoints)
assertContainsTaggedFloat(t, acc, "user", 11.4, 0, cputags) assertContainsTaggedFloat(t, acc, "time_user", 11.4, 0, cputags)
assertContainsTaggedFloat(t, acc, "system", 10.9, 0, cputags) assertContainsTaggedFloat(t, acc, "time_system", 10.9, 0, cputags)
assertContainsTaggedFloat(t, acc, "idle", 158.8699, 0, cputags) assertContainsTaggedFloat(t, acc, "time_idle", 158.8699, 0, cputags)
assertContainsTaggedFloat(t, acc, "nice", 2.5, 0, cputags) assertContainsTaggedFloat(t, acc, "time_nice", 2.5, 0, cputags)
assertContainsTaggedFloat(t, acc, "iowait", 0.7, 0, cputags) assertContainsTaggedFloat(t, acc, "time_iowait", 0.7, 0, cputags)
assertContainsTaggedFloat(t, acc, "irq", 1.2, 0, cputags) assertContainsTaggedFloat(t, acc, "time_irq", 1.2, 0, cputags)
assertContainsTaggedFloat(t, acc, "softirq", 0.31, 0, cputags) assertContainsTaggedFloat(t, acc, "time_softirq", 0.31, 0, cputags)
assertContainsTaggedFloat(t, acc, "steal", 0.2812, 0, cputags) assertContainsTaggedFloat(t, acc, "time_steal", 0.2812, 0, cputags)
assertContainsTaggedFloat(t, acc, "guest", 12.9, 0, cputags) assertContainsTaggedFloat(t, acc, "time_guest", 12.9, 0, cputags)
assertContainsTaggedFloat(t, acc, "guest_nice", 2.524, 0, cputags) assertContainsTaggedFloat(t, acc, "time_guest_nice", 2.524, 0, cputags)
assertContainsTaggedFloat(t, acc, "usage_user", 8.3, 0.0005, cputags) assertContainsTaggedFloat(t, acc, "usage_user", 8.3, 0.0005, cputags)
assertContainsTaggedFloat(t, acc, "usage_system", 2.7, 0.0005, cputags) assertContainsTaggedFloat(t, acc, "usage_system", 2.7, 0.0005, cputags)