File tree Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -2297,3 +2297,43 @@ services:
22972297 assert .Equal (t , project .Services [0 ].Name , "extension" )
22982298 assert .Equal (t , project .Services [0 ].Extensions ["x-foo" ], "bar" )
22992299}
2300+
2301+ func TestDeviceWriteBps (t * testing.T ) {
2302+ p , err := loadYAML (`
2303+ name: test
2304+ services:
2305+ foo:
2306+ image: busybox
2307+ blkio_config:
2308+ device_read_bps:
2309+ - path: /dev/test
2310+ rate: 1024k
2311+ device_write_bps:
2312+ - path: /dev/test
2313+ rate: 1024
2314+ ` )
2315+ assert .NilError (t , err )
2316+ assert .DeepEqual (t , p .Services , types.Services {
2317+ {
2318+ Name : "foo" ,
2319+ Image : "busybox" ,
2320+ Environment : types.MappingWithEquals {},
2321+ Scale : 1 ,
2322+ BlkioConfig : & types.BlkioConfig {
2323+ DeviceReadBps : []types.ThrottleDevice {
2324+ {
2325+ Path : "/dev/test" ,
2326+ Rate : types .UnitBytes (1024 * 1024 ),
2327+ },
2328+ },
2329+ DeviceWriteBps : []types.ThrottleDevice {
2330+ {
2331+ Path : "/dev/test" ,
2332+ Rate : types .UnitBytes (1024 ),
2333+ },
2334+ },
2335+ },
2336+ },
2337+ })
2338+
2339+ }
Original file line number Diff line number Diff line change @@ -340,7 +340,7 @@ type WeightDevice struct {
340340// ThrottleDevice is a structure that holds device:rate_per_second pair
341341type ThrottleDevice struct {
342342 Path string
343- Rate uint64
343+ Rate UnitBytes
344344
345345 Extensions Extensions `mapstructure:"#extensions" yaml:",inline" json:"-"`
346346}
You can’t perform that action at this time.
0 commit comments