mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
2333b39b37
Signed-off-by: Aaron.L.Xu <liker.xu@foxmail.com>
20 lines
586 B
Go
20 lines
586 B
Go
package container
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/docker/docker/api/types"
|
|
)
|
|
|
|
func TestCalculateBlockIO(t *testing.T) {
|
|
blkio := types.BlkioStats{
|
|
IoServiceBytesRecursive: []types.BlkioStatEntry{{Major: 8, Minor: 0, Op: "read", Value: 1234}, {Major: 8, Minor: 1, Op: "read", Value: 4567}, {Major: 8, Minor: 0, Op: "write", Value: 123}, {Major: 8, Minor: 1, Op: "write", Value: 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)
|
|
}
|
|
}
|