5ffe496a22
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
20 lines
486 B
Go
20 lines
486 B
Go
package container
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/docker/docker/api/types"
|
|
)
|
|
|
|
func TestCalculateBlockIO(t *testing.T) {
|
|
blkio := types.BlkioStats{
|
|
IoServiceBytesRecursive: []types.BlkioStatEntry{{8, 0, "read", 1234}, {8, 1, "read", 4567}, {8, 0, "write", 123}, {8, 1, "write", 456}},
|
|
}
|
|
blkRead, blkWrite := calculateBlockIO(blkio)
|
|
if blkRead != 5801 {
|
|
t.Fatalf("blkRead = %d, want 5801", blkRead)
|
|
}
|
|
if blkWrite != 579 {
|
|
t.Fatalf("blkWrite = %d, want 579", blkWrite)
|
|
}
|
|
}
|