stats_unit_test.go 486 B

1234567891011121314151617181920
  1. package container
  2. import (
  3. "testing"
  4. "github.com/docker/docker/api/types"
  5. )
  6. func TestCalculateBlockIO(t *testing.T) {
  7. blkio := types.BlkioStats{
  8. IoServiceBytesRecursive: []types.BlkioStatEntry{{8, 0, "read", 1234}, {8, 1, "read", 4567}, {8, 0, "write", 123}, {8, 1, "write", 456}},
  9. }
  10. blkRead, blkWrite := calculateBlockIO(blkio)
  11. if blkRead != 5801 {
  12. t.Fatalf("blkRead = %d, want 5801", blkRead)
  13. }
  14. if blkWrite != 579 {
  15. t.Fatalf("blkWrite = %d, want 579", blkWrite)
  16. }
  17. }