Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: more compatibility fixes #1242

Merged
merged 3 commits into from
Jul 13, 2023
Merged

Conversation

paravoid
Copy link
Contributor

I'm still pursuing the goal of running the upstream test suite as part of the Debian CI process (as outlined in #1197; also see prior work in #1194 & #1196). Below you'll find a few fixes to bugs I encountered in the process. With this PR everything except one test, sd-notify-proxy[1], runs in both rootful and rootless configurations.

Let me know what you think - thanks!

1: I'm still trying to track that down and I'm already seeing a few things in the test that don't make sense to me. A retroactive review and/or suggestions on what could possibly be going wrong are more than welcome :)

Use get_crun_path() from tests_util.py rather than hardcoding "./crun"
in the newly introduced (935f4fe)
test_oci_features.py test.

Signed-off-by: Faidon Liambotis <paravoid@debian.org>
test_uid_tty(), introduced recently with commit
710d8dd, only works (by definition) if
a tty exists.

Skip if we're not running under a tty, in a similar way to how the
test_tty.py tests are being constrained.

Signed-off-by: Faidon Liambotis <paravoid@debian.org>
The crun systemd cgroup manager tries to connect to the user manager
first, and only falls back to the system manager if that fails
(open_sd_bus_connection in src/libcrun/cgroup-systemd.c)

Thus the scope is created under user.slice -> user-0.slice ->
user@0.service -> app.slice -> crun-test-tmp4_wkotzy.scope.

The test tries to validate that CPUWeight was set by running (e.g.):
  systemctl show crun-test-tmp4_wkotzy.scope
This fails, because --system is implied and there is no such scope in
the system manager, as the scope was created in the user manager.
The correct command in this case would be:
  systemctl --user show crun-test-tmp4_wkotzy.scope

This test failure was not caught up until now because a) the test is
skipped if rootless, b) root usually is not logged in into a tty, and a
user manager (DBus session) does not exist. However it /can/ happen, and
did happen in the Debian autopkgtest environment.

Fix this by trying "systemctl show" twice: once against the system
manager and once against the user manager. The fix is kinda ugly and
repetitive, but abstracting this for two callsites looked even uglier.

Closes: containers#1197

Signed-off-by: Faidon Liambotis <paravoid@debian.org>
Copy link
Collaborator

@flouthoc flouthoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @giuseppe PTAL

Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@giuseppe giuseppe merged commit 017bd29 into containers:main Jul 13, 2023
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants