Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions loader/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2297,3 +2297,43 @@ services:
assert.Equal(t, project.Services[0].Name, "extension")
assert.Equal(t, project.Services[0].Extensions["x-foo"], "bar")
}

func TestDeviceWriteBps(t *testing.T) {
p, err := loadYAML(`
name: test
services:
foo:
image: busybox
blkio_config:
device_read_bps:
- path: /dev/test
rate: 1024k
device_write_bps:
- path: /dev/test
rate: 1024
`)
assert.NilError(t, err)
assert.DeepEqual(t, p.Services, types.Services{
{
Name: "foo",
Image: "busybox",
Environment: types.MappingWithEquals{},
Scale: 1,
BlkioConfig: &types.BlkioConfig{
DeviceReadBps: []types.ThrottleDevice{
{
Path: "/dev/test",
Rate: types.UnitBytes(1024 * 1024),
},
},
DeviceWriteBps: []types.ThrottleDevice{
{
Path: "/dev/test",
Rate: types.UnitBytes(1024),
},
},
},
},
})

}
2 changes: 1 addition & 1 deletion types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ type WeightDevice struct {
// ThrottleDevice is a structure that holds device:rate_per_second pair
type ThrottleDevice struct {
Path string
Rate uint64
Rate UnitBytes

Extensions Extensions `mapstructure:"#extensions" yaml:",inline" json:"-"`
}
Expand Down