Another test to check for invalid stats.
Docker-DCO-1.1-Signed-off-by: Rohit Jnagal <jnagal@google.com> (github: rjnagal)
This commit is contained in:
parent
51d9b2b0a0
commit
ed65857dae
1 changed files with 17 additions and 0 deletions
|
@ -38,3 +38,20 @@ func TestNoCpuStatFile(t *testing.T) {
|
||||||
t.Fatal("Expected to fail, but did not.")
|
t.Fatal("Expected to fail, but did not.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestInvalidCpuStat(t *testing.T) {
|
||||||
|
helper := NewCgroupTestUtil("cpu", t)
|
||||||
|
defer helper.cleanup()
|
||||||
|
cpuStatContent := `nr_periods 2000
|
||||||
|
nr_throttled 200
|
||||||
|
throttled_time fortytwo`
|
||||||
|
helper.writeFileContents(map[string]string{
|
||||||
|
"cpu.stat": cpuStatContent,
|
||||||
|
})
|
||||||
|
|
||||||
|
cpu := &cpuGroup{}
|
||||||
|
_, err := cpu.Stats(helper.CgroupData)
|
||||||
|
if err == nil {
|
||||||
|
t.Fatal("Expected failed stat parsing.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue