github.com/kunnos/engine@v1.13.1/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 TestCalculateBlockIO(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 }