Skip to content

Commit

Permalink
cri: fix integration test on cgroupsv2 system
Browse files Browse the repository at this point in the history
TestUpdateContainerResources_MemoryLimit still uses old method to
check memlimit in cgroup.

Signed-off-by: Shengjing Zhu <[email protected]>
  • Loading branch information
zhsj committed Feb 28, 2022
1 parent 5247172 commit 775facd
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions integration/container_update_resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,8 @@ func TestUpdateContainerResources_MemoryLimit(t *testing.T) {
require.NoError(t, err)

t.Log("Check memory limit in cgroup")
cgroup, err := cgroups.Load(cgroups.V1, cgroups.PidPath(int(task.Pid())))
require.NoError(t, err)
stat, err := cgroup.Stat(cgroups.IgnoreNotExist)
require.NoError(t, err)
assert.Equal(t, uint64(400*1024*1024), stat.Memory.Usage.Limit)
memLimit := getCgroupMemoryLimitForTask(t, task)
assert.Equal(t, uint64(400*1024*1024), memLimit)

t.Log("Update container memory limit after started")
err = runtimeService.UpdateContainerResources(cn, &runtime.LinuxContainerResources{
Expand All @@ -278,7 +275,6 @@ func TestUpdateContainerResources_MemoryLimit(t *testing.T) {
checkMemoryLimit(t, spec, 800*1024*1024)

t.Log("Check memory limit in cgroup")
stat, err = cgroup.Stat(cgroups.IgnoreNotExist)
require.NoError(t, err)
assert.Equal(t, uint64(800*1024*1024), stat.Memory.Usage.Limit)
memLimit = getCgroupMemoryLimitForTask(t, task)
assert.Equal(t, uint64(800*1024*1024), memLimit)
}

0 comments on commit 775facd

Please sign in to comment.