Repository navigation
tests/rootless.sh: fix skipping idmap tests for systemd - #5226
Conversation
07a857d to
0029b25
Compare
| # We use `ssh rootless@localhost` instead of `sudo -u rootless` for creating systemd user session. | ||
| # Alternatively we could use `machinectl shell`, but it is known not to work well on SELinux-enabled hosts as of April 2020: | ||
| # https://bugzilla.redhat.com/show_bug.cgi?id=1788616 | ||
| ssh -t -t -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i "$HOME/.ssh/rootless.key" rootless@localhost -- PATH="$PATH" RUNC_USE_SYSTEMD="$RUNC_USE_SYSTEMD" bats -t "$ROOT/tests/integration$ROOTLESS_TESTPATH" |
There was a problem hiding this comment.
Maybe we can use $(env | grep -E '\S' | xargs -d $'\n' printf 'export %q; ') in the ssh command?
I think this will ensure we don't miss any other envs in the future.
There was a problem hiding this comment.
I think both this PR and #5224 can be fixed by this way.
There was a problem hiding this comment.
No, we do not want to supply ALL local variables, this will most probably break the test (values for $HOME etc). We don't want to supply all exported variables either.
It's probably better to have a list at the top of the file; I'll rework this.
There was a problem hiding this comment.
No, we do not want to supply ALL local variables, this will most probably break the test (values for $HOME etc). We don't want to supply all exported variables either.
Ah, I see, it's rootless, not root.
Also, fix the typo (AUX_DIX) in cleanup. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
0029b25 to
0825542
Compare
When RUNC_USE_SYSTEMD is set, tests/rootless.sh is using
ssh -tt rootless@localhost
to run tests as rootless user. In this case, local environment is not
passed to the user's ssh session (unless explicitly specified), and so
the tests do not get ROOTLESS_FEATURES.
As a result, idmap-related tests are skipped when running as rootless
using systemd cgroup driver:
integration test (systemd driver)
...
[02] run rootless tests ... (idmap)
...
ok 286 runc run detached ({u,g}id != 0) # skip test requires rootless_idmap
...
Fix this by creating a list of environment variables needed by the
tests, and adding those to ssh command line (in case of ssh) or
exporting (in case of sudo) so both cases work similarly.
Also, modify disable_idmap to unset variables set in enable_idmap so
they are not exported at all if idmap is not in features.
Fixes: bf15cc9 ("cgroup v2: support rootless systemd")
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
0825542 to
3e0829d
Compare
When RUNC_USE_SYSTEMD is set, tests/rootless.sh is using
to run tests as rootless user. In this case, local environment is not passed to the user's ssh session (unless explicitly specified), and so the tests do not get ROOTLESS_FEATURES.
As a result we skip tests idmap-related tests when running as rootless using systemd cgroup driver, e.g.:
Fix this.
Fixes: bf15cc9 ("cgroup v2: support rootless systemd")