Skip to content

Commit

Permalink
More fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bduffany committed Nov 19, 2024
1 parent 55a8b2b commit 7c77868
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion enterprise/server/remote_execution/cgroup/cgroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func settingsMap(s *scpb.CgroupSettings, blockDevice *block_io.Device) map[strin
if s.CpuQuotaLimitUsec != nil {
if s.CpuQuotaPeriodUsec == nil {
// Keep current or default period (100ms) but update quota.
m["cpu.max"] = strconv.Itoa(int(s.GetCpuQuotaPeriodUsec()))
m["cpu.max"] = strconv.Itoa(int(s.GetCpuQuotaLimitUsec()))
} else {
m["cpu.max"] = fmt.Sprintf("%d %d", s.GetCpuQuotaLimitUsec(), s.GetCpuQuotaPeriodUsec())
}
Expand Down
9 changes: 9 additions & 0 deletions enterprise/server/remote_execution/cgroup/cgroup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ func TestSettingsMap(t *testing.T) {
"io.max": "279:8 riops=1000 wiops=500 rbps=4096000 wbps=1024000",
},
},
{
name: "write cpu quota without limit",
settings: &scpb.CgroupSettings{
CpuQuotaLimitUsec: proto.Int64(300_000),
},
expectedMap: map[string]string{
"cpu.max": "300000",
},
},
} {
t.Run(test.name, func(t *testing.T) {
device := &block_io.Device{Maj: 279, Min: 8}
Expand Down

0 comments on commit 7c77868

Please sign in to comment.