Enable boot-and-service autopkgtest in containers
- Skip tests which can't work in containers. - Add missing rsyslog test dependency. - e2scrub_reap.service fails in containers, ignore (filed as #926138) - Relax pgrep pattern for gdm, as there's no wayland session in containers.
-
Hi @mpitt , trying to run autopkgtest (under sid), I get a test-suite failure after this change: From logs-lxc/boot-and-services-stdout
lxc lxc test_profile (__main__.AppArmorTest) AppArmor confined unit ... skipped 'AppArmor not enabled' test_help (__main__.CLITest) --help works and succeeds ... ok test_invalid_option (__main__.CLITest) Calling with invalid option fails ... ok test_version (__main__.CLITest) --version works and succeeds ... ok test_cpushares (__main__.CgroupsTest) service with CPUShares ... ok test_simple (__main__.CgroupsTest) simple service ... ok test_bash_crash (__main__.CoredumpTest) ... skipped 'systemd-coredump does not work in containers' test_log_for_service (__main__.JournalTest) ... ok test_no_options (__main__.JournalTest) ... FAIL test_boot (__main__.NspawnTest) ... skipped 'nspawn does not work in most containers' test_service (__main__.NspawnTest) ... skipped 'nspawn does not work in most containers' test_failing (__main__.SeccompTest) ... ok test_0_init (__main__.ServicesTest) Verify that init is systemd ... ok test_cron (__main__.ServicesTest) ... ok test_dbus (__main__.ServicesTest) ... ok test_gdm3 (__main__.ServicesTest) ... ERROR test_logind (__main__.ServicesTest) ... ok test_network_manager (__main__.ServicesTest) ... ok test_no_failed (__main__.ServicesTest) No failed units ... ok test_rsyslog (__main__.ServicesTest) ... FAIL test_tmp_cleanup (__main__.ServicesTest) ... ok test_tmp_mount (__main__.ServicesTest) ... ok test_udev (__main__.ServicesTest) ... skipped 'udev does not work in containers' ====================================================================== ERROR: test_gdm3 (__main__.ServicesTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/autopkgtest-lxc.c0zqwt40/downtmp/build.tAm/src/debian/tests/boot-and-services", line 71, in test_gdm3 subprocess.check_call(['pgrep', '-af', '/gdm[-3]']) File "/usr/lib/python3.7/subprocess.py", line 347, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['pgrep', '-af', '/gdm[-3]']' returned non-zero exit status 1. ====================================================================== FAIL: test_no_options (__main__.JournalTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/autopkgtest-lxc.c0zqwt40/downtmp/build.tAm/src/debian/tests/boot-and-services", line 191, in test_no_options self.assertRegex(out, b'systemd.*Reached target Graphical Interface')
-
Hmm - FTR, I ran that with
autopkgtest -B --test-name boot-and-services -s -- lxc -s sid-amd64
, although that shouldn't be too surprising; I also tried bionic-amd64. But my container is a few days old. Unfortunately I can't useautopkgtest-build-lxc debian sid
as-is on my Fedora host, as that doesn't ship the debian templates, so I usedlxc-create -B best --name=sid-amd64 -t download -- -d debian -r sid -a amd64
and then ran setup-commands/setup-testbed manually in the container. Maybe that does things subtly different.My first hunch is that this is related to whether graphical.target gets booted by default or not. In my containers this seems to be the case. Does this help?
--- a/debian/tests/boot-and-services +++ b/debian/tests/boot-and-services @@ -516,6 +516,8 @@ class CLITest(unittest.TestCase): def pre_boot_setup(): '''Test setup before rebooting testbed''' + subprocess.check_call(['systemctl', 'set-default', 'graphical.target']) + # create a few temporary files to ensure that they get cleaned up on boot os.close(os.open('/tmp/newfile.test', os.O_CREAT | os.O_EXCL | os.O_WRONLY))
If it doesn't help, could you run the test with
-s
, check ifgraphical.target
and gdm are actually running? -
You are spot on:
root@autopkgtest-sid:/tmp/autopkgtest-lxc.7al3hvis/downtmp/build.yDe/src# ls -al /etc/systemd/system/default.target lrwxrwxrwx 1 root root 37 Apr 2 18:54 /etc/systemd/system/default.target -> /lib/systemd/system/multi-user.target
This is a LXC container created with
autopkgtest-build-lxc debian sid
, autopkgtest is version 5.10. -
michael@pluto:/tmp/lxc-templates-3.0.3$ grep default.target -R templates/lxc-openmandriva.in: unlink ${rootfs_path}/etc/systemd/system/default.target templates/lxc-openmandriva.in: chroot ${rootfs_path} ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target templates/lxc-fedora.in: /etc/systemd/system/default.target templates/lxc-debian.in: rm -f "${rootfs}/etc/systemd/system/default.target" templates/lxc-debian.in: chroot "${rootfs}" ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target templates/lxc-archlinux.in:ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target templates/lxc-pld.in: unlink ${rootfs_path}/etc/systemd/system/default.target templates/lxc-pld.in: chroot ${rootfs_path} ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target templates/lxc-fedora-legacy.in: rm -f ${rootfs_path}/etc/systemd/system/default.target templates/lxc-fedora-legacy.in: chroot ${rootfs_path} ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
@mpitt should we file a bug against lxc-templates or workaround that in our test suite?
@peb can you provide some insight why lxc-templates overrides
default.target
?Edited by Michael Biebl -
@mpitt: regarding your proposed patch, you'll need to pass
--quiet
, otherwise I getboot-and-services FAIL stderr: Removed /etc/systemd/system/default.target.
-
mentioned in commit b96b67ca
-
@biebl: Reproduced, and verified that the fix works; I just pushed. Sorry for the hiccup!