Fix running tests under Docker/Podman and cgroup v2#3960
Merged
AkihiroSuda merged 4 commits intoopencontainers:mainfrom Aug 3, 2023
Merged
Fix running tests under Docker/Podman and cgroup v2#3960AkihiroSuda merged 4 commits intoopencontainers:mainfrom
AkihiroSuda merged 4 commits intoopencontainers:mainfrom
Conversation
Member
|
Is this a systemd bug, or something else? It seems very strange that EDIT: Oh, I finally understand the issue. The no-internal-nodes constraint strikes again... |
Contributor
Author
|
OK, after merging #3954 my Added two small fixes to unit tests, which assumed systemd is there. With this, the following passes on my machine (Fedora/Podman): Note that the above do not test runc systemd cgroup driver; for that, I usually run |
Contributor
Author
|
Added one more commit to fix a flake (not related to cgroup v2 but the fix is easy) |
cyphar
reviewed
Aug 3, 2023
For "make integration", the tests are run inside a Docker/Podman container. Problem is, if cgroup v2 is used, the in-container /sys/fs/cgroup/cgroup.subtree_control is empty. The added script, used as Docker entrypoint, moves the current process into a sub-cgroup, and then adds all controllers in top-level cgroup.subtree_control. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Split the test into two -- for fs and systemd cgroup managers, and only run the second one if systemd is available. Prevents the following failure during `make unittest`: > === RUN TestNilResources > manager_test.go:27: systemd not running on this host, cannot use systemd cgroups manager > --- FAIL: TestNilResources (0.22s) Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
A few cases relied on the fact that systemd is used, and thus /sys/fs/cgroup/user.slice is available. Guess what, in case of "make unittest" it might not be. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This test fails in CI sometimes with the following error: > `testcontainer test_update stopped' failed Give OOM killer some time to do its job. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Contributor
Author
|
@AkihiroSuda PTAL |
AkihiroSuda
reviewed
Aug 3, 2023
cyphar
approved these changes
Aug 3, 2023
AkihiroSuda
approved these changes
Aug 3, 2023
Contributor
Author
|
Backported to 1.1 in #3976. |
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.
For "make integration", the tests are run inside a Docker/Podman container. Problem is, if cgroup v2 is used, the in-container /sys/fs/cgroup/cgroup.subtree_control is empty.
The added script, used as Docker entrypoint, moves the current process into a sub-cgroup, and then adds all controllers in top-level cgroup.subtree_control.
Addresses #3955