Testing service across restart/reboot
I would like to test how the service I've packaged behaves across restarts/boots. I want to ensure that the service is running after the package has been installed, and that it keeps running after a restart/boot, and that e.g. if systemctl disable <service>
ran it would not restart on boot.
How could this be achieved on Salsa-CI?
This is how I currently test locally:
docker run -d --name restart-test --privileged -v "${PWD}:/test" -w /test --shm-size=1G -v /sys/fs/cgroup:/sys/fs/cgroup:ro jrei/systemd-debian:sid
docker exec -it restart-test bash
# install packages
# ensure service is running with `systemctl status <service>`
# reboot
sleep 15
docker start restart-test
docker exec -it restart-test bash
# ensure again services are OK
# exit
docker stop restart-test && docker rm restart-test
I am happy with an environment that has systemd or sysvinit style system for restarting after boot. If systemd is not available, using the systemctl
shim package is OK.
Extra bonus if the system could also run systemd-analyze verify <service>
to statically test service files for validity.