diff --git a/e2e/cgroups/cgroups.go b/e2e/cgroups/cgroups.go index 9d888295de..3fe24ada26 100644 --- a/e2e/cgroups/cgroups.go +++ b/e2e/cgroups/cgroups.go @@ -615,11 +615,12 @@ var resourceFlagTests = []resourceFlagTest{ controllerV1: "cpu", resourceV1: "cpu.shares", expectV1: "123", - // Cgroups v2 has a conversion from shares to weight: - // weight = (1 + ((cpuShares-2)*9999)/262142) + // Cgroups v2 has a conversion from shares to weight. The formula has + // changed between opencontainer/cgroups versions, and runc / crun + // versions. See https://github.com/opencontainers/cgroups/pull/20 delegationV2: "cpu", resourceV2: "cpu.weight", - expectV2: "5", + expectV2: "5|20", }, { name: "cpuset-cpus", @@ -729,7 +730,7 @@ func (c *ctx) actionFlagV1(t *testing.T, tt resourceFlagTest, profile e2e.Profil exitFunc := []e2e.SingularityCmdResultOp{} if tt.expectV1 != "" { - exitFunc = []e2e.SingularityCmdResultOp{e2e.ExpectOutput(e2e.ContainMatch, tt.expectV1)} + exitFunc = []e2e.SingularityCmdResultOp{e2e.ExpectOutput(e2e.RegexMatch, tt.expectV1)} } args := tt.args @@ -759,7 +760,7 @@ func (c *ctx) actionFlagV2(t *testing.T, tt resourceFlagTest, profile e2e.Profil exitFunc := []e2e.SingularityCmdResultOp{} if tt.expectV2 != "" { - exitFunc = []e2e.SingularityCmdResultOp{e2e.ExpectOutput(e2e.ContainMatch, tt.expectV2)} + exitFunc = []e2e.SingularityCmdResultOp{e2e.ExpectOutput(e2e.RegexMatch, tt.expectV2)} } // Use shell in the container to find container cgroup and cat the value for the tested controller & resource. diff --git a/go.mod b/go.mod index 333b111017..5747d58786 100644 --- a/go.mod +++ b/go.mod @@ -37,7 +37,7 @@ require ( github.com/moby/sys/user v0.4.0 github.com/moby/sys/userns v0.1.0 github.com/moby/term v0.5.2 - github.com/opencontainers/cgroups v0.0.2 + github.com/opencontainers/cgroups v0.0.3 github.com/opencontainers/image-spec v1.1.1 github.com/opencontainers/runc v1.3.0 github.com/opencontainers/runtime-spec v1.2.1 diff --git a/go.sum b/go.sum index 6ad60ba22f..108182631a 100644 --- a/go.sum +++ b/go.sum @@ -672,8 +672,8 @@ github.com/onsi/gomega v1.37.0 h1:CdEG8g0S133B4OswTDC/5XPSzE1OeP29QOioj2PID2Y= github.com/onsi/gomega v1.37.0/go.mod h1:8D9+Txp43QWKhM24yyOBEdpkzN8FvJyAwecBgsU4KU0= github.com/open-policy-agent/opa v1.1.0 h1:HMz2evdEMTyNqtdLjmu3Vyx06BmhNYAx67Yz3Ll9q2s= github.com/open-policy-agent/opa v1.1.0/go.mod h1:T1pASQ1/vwfTa+e2fYcfpLCvWgYtqtiUv+IuA/dLPQs= -github.com/opencontainers/cgroups v0.0.2 h1:A+mAPPMfgKNCEZUUtibESFx06uvhAmvo8sSz3Abwk7o= -github.com/opencontainers/cgroups v0.0.2/go.mod h1:s8lktyhlGUqM7OSRL5P7eAW6Wb+kWPNvt4qvVfzA5vs= +github.com/opencontainers/cgroups v0.0.3 h1:Jc9dWh/0YLGjdy6J/9Ln8NM5BfTA4W2BY0GMozy3aDU= +github.com/opencontainers/cgroups v0.0.3/go.mod h1:s8lktyhlGUqM7OSRL5P7eAW6Wb+kWPNvt4qvVfzA5vs= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040=