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 <zhsj@debian.org>
(cherry picked from commit 775facd)
Signed-off-by: Wei Fu <fuweid89@gmail.com>
  • Loading branch information
zhsj authored and fuweid committed Jan 14, 2024
1 parent 9cf1e1a commit 65e1656
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions integration/container_update_resources_test.go
Expand Up @@ -270,11 +270,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)
swapLimit := getCgroupSwapLimitForTask(t, task)
assert.Equal(t, uint64(400*1024*1024), swapLimit)

Expand All @@ -291,9 +288,8 @@ func TestUpdateContainerResources_MemoryLimit(t *testing.T) {
checkMemorySwapLimit(t, spec, expectedSwapLimit(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)
swapLimit = getCgroupSwapLimitForTask(t, task)
assert.Equal(t, uint64(800*1024*1024), swapLimit)
}
Expand Down

0 comments on commit 65e1656

Please sign in to comment.