Repository navigation
tests: run test_mounts.py in the CI, fix what it finds - #2393
Merged
Merged
Conversation
check_idmapped_mounts() relies on PR_SET_PDEATHSIG to get rid of the child it creates, but the child sets it only after clone() returns, by which time the parent may already be gone, leaving the child paused forever. As it inherits stdout and stderr, whatever reads them waits for it as well, and a test run hangs. Exit the child if its parent changed after setting PR_SET_PDEATHSIG. Assisted-by: Claude Code (claude-opus-5-5) Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Collaborator
Author
|
Regarding "linux: do not require openat2 in |
kolyshkin
force-pushed
the
test-mounts-ci
branch
from
October 21, 2026 06:31
53e8d68 to
9a52179
Compare
Since commit 7d7b81f ("linux: do not follow symlinks in `mounts remove`"), both `mounts add` and `mounts remove` require openat2 with RESOLVE_NO_SYMLINKS, and fail with ENOSYS where it is not available, which is what check-no-openat2 emulates: open `/foo/bar`: Function not implemented Add `check-feature openat2` to tests/init, and skip the tests using `mounts add` or `mounts remove` where openat2 does not work. Assisted-by: Claude Code (claude-opus-5-5) Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
do_mount_in_a_container() joins only the mount namespace of the container, so a missing destination is created by the root user of the host. When it is in a file system owned by the user namespace of the container, e.g. a tmpfs, where the root user of the host has no mapping, mkdir fails with EOVERFLOW: mkdir `/foo/tmpfs`: Value too large for defined data type Create the missing destinations first, from a process that also joined the user namespace of the container and switched to its root user, as the container itself would. The mounts are still moved in place by the root user of the host. Assisted-by: Claude Code (claude-opus-5-5) Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
test_add_mounts_container_namespaces and helper_add_mounts_nested_userns map the root user of the container to the host uid 1, but create the rootfs in a directory only the host root can access, so the container fails to start: open `rootfs`: Permission denied Chown the rootfs to the user the container root is mapped to, as the other tests using this mapping do. Assisted-by: Claude Code (claude-opus-5-5) Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
In helper_add_mounts_nested_userns, the container process moves to a new user namespace without any mapping, and `crun exec` joins it, so the check of the added mounts fails: setgroups: Operation not permitted Read the mounts of the container process from the host instead. Assisted-by: Claude Code (claude-opus-5-5) Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
mount-overlay-fs creates the lower, upper and work directories with tempfile.mkdtemp(), that is in /tmp. When the tests run in a container, as in the centos10-build CI job, /tmp is on overlayfs, which is not supported as upperdir, and the container fails to start: overlay: filesystem on .../upper not supported as upperdir Create them under the tests root, as other tests in this file do. Assisted-by: Claude Code (claude-opus-5-5) Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
The rshared bind mount loses the peer group of its source on some kernels, e.g. 6.12 on CentOS Stream 10, see containers#2392. Skip the test when the mount is not shared at all, until it is fixed. Assisted-by: Claude Code (claude-opus-5-5) Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
The whole file is skipped if the libmount python module is not available, which is the case on the Ubuntu runners of the CI, so none of the mount tests is run there. Import it only where it is used, and skip only the tests that need it. Assisted-by: Claude Code (claude-opus-5-5) Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
kolyshkin
force-pushed
the
test-mounts-ci
branch
from
October 21, 2026 06:56
9a52179 to
674f714
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tests/test_mounts.pyis skipped as a whole when thelibmountpython module is not available, which is the case on the Ubuntu runners, so none of the mount tests runs in the CI. This makes the import lazy, so that only the 15 tests needing it are skipped, and fixes what was broken meanwhile:check-feature idmapped-mountscould leave its child paused forever if the parent exited before the child setPR_SET_PDEATHSIG; holding stdout, it made the test run hang.crun mounts addcreated a missing destination as the root user of the host, which fails withEOVERFLOWin a file system owned by the user namespace of the container (e.g. a tmpfs). The destinations are now created by the root user of the container.mount-add-mounts-container-namespaces,mount-add-mounts-nested-userns-mountnsandmount-add-mounts-nested-usernscould not start the container with userns (rootfs not accessible to the mapped root), and the latter usedcrun execinto a user namespace without mappings.mount-propagation-sharedfails on kernel 6.12 (CentOS Stream 10), and likely on the Ubuntu runners as well; it is skipped when the mount is not shared at all, see rshared bind mount loses the peer group of its source on kernel 6.12 #2392.mounts add/removetests are skipped whereopenat2is not available, as incheck-no-openat2.mount-overlay-fscreated the overlay layers in/tmp, which is on overlayfs when the tests run in a container (found bycentos10-build).Tested on Fedora 45 (kernel 7.3) and CentOS Stream 10 (kernel 6.12), as root (cgroupfs and systemd), rootless, with
unshare -rand withtests/no_openat2: all oftest_mounts.pypasses, with or without the libmount module (withtests/no_openat2, themounts add/removetests are skipped).