This repository has no description
1//go:build linux
2
3package microvm
4
5import "testing"
6
7func TestCgroupResourcesCPUQuota(t *testing.T) {
8 r := cgroupResources(CgroupLimits{CPUQuotaPercent: 200})
9 if r.CPU == nil {
10 t.Fatal("cpu quota should produce a cpu controller config")
11 }
12 if got := string(r.CPU.Max); got != "200000 100000" {
13 t.Errorf("cpu.max = %q, want %q", got, "200000 100000")
14 }
15
16 r = cgroupResources(CgroupLimits{})
17 if r.CPU != nil {
18 t.Errorf("no quota should leave cpu unlimited, got %v", r.CPU)
19 }
20}