Skip to content

Commit

Permalink
test runc exec with RLIMIT_NOFILE
Browse files Browse the repository at this point in the history
Signed-off-by: lifubang <[email protected]>
  • Loading branch information
lifubang committed May 3, 2024
1 parent 7a017af commit 411acf4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ task:
install_dependencies_script: |
case $DISTRO in
centos-7)
# https://github.com/opencontainers/runc/pull/4265#discussion_r1588579628
ulimit -H -n 1048576
(cd /etc/yum.repos.d && curl -O https://copr.fedorainfracloud.org/coprs/adrian/criu-el7/repo/epel-7/adrian-criu-el7-epel-7.repo)
# EPEL is needed for jq and fuse-sshfs.
rpm -q epel-release || rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Expand Down
17 changes: 17 additions & 0 deletions tests/integration/exec.bats
Original file line number Diff line number Diff line change
Expand Up @@ -476,3 +476,20 @@ EOF
[ "$status" -eq 0 ]
[[ "${lines[0]}" == "Cpus_allowed_list: $all_cpus" ]]
}

@test "runc exec with RLIMIT_NOFILE" {
update_config '.process.rlimits = [{"type": "RLIMIT_NOFILE", "hard": 65536, "soft": 65536}]'

runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
[ "$status" -eq 0 ]

update_config '.process.args = ["/bin/sh", "-c", "ulimit -n"]'
runc run test_ulimit
[ "$status" -eq 0 ]
[[ "${output}" == "65536" ]]

# issue: https://github.com/opencontainers/runc/issues/4195
runc exec test_busybox /bin/sh -c "ulimit -n"
[ "$status" -eq 0 ]
[[ "${output}" == "65536" ]]
}

0 comments on commit 411acf4

Please sign in to comment.