github.com/vieux/docker@v0.6.3-0.20161004191708-e097c2a938c7/cli/command/container/stats_unit_test.go (about) 1 package container 2 3 import ( 4 "testing" 5 6 "github.com/docker/docker/api/types" 7 ) 8 9 func TestCalculBlockIO(t *testing.T) { 10 blkio := types.BlkioStats{ 11 IoServiceBytesRecursive: []types.BlkioStatEntry{{8, 0, "read", 1234}, {8, 1, "read", 4567}, {8, 0, "write", 123}, {8, 1, "write", 456}}, 12 } 13 blkRead, blkWrite := calculateBlockIO(blkio) 14 if blkRead != 5801 { 15 t.Fatalf("blkRead = %d, want 5801", blkRead) 16 } 17 if blkWrite != 579 { 18 t.Fatalf("blkWrite = %d, want 579", blkWrite) 19 } 20 }