set -xeuo pipefail
. "$KOLA_EXT_DATA/commonlib.sh"
case "${AUTOPKGTEST_REBOOT_MARK:-}" in
"")
if [ $(stat --format="%a" /etc/systemd/system/ignition-delete-config.service.d/50-kola.conf) != "644" ]; then
fatal "dropin file permission should be 644"
fi
if [ ! -e /run/ignition-rmcfg-ran ]; then
fatal "mocked ignition-rmcfg did not run on first boot"
fi
if [ $(systemctl is-active ignition-delete-config ||:) != active ]; then
fatal "ignition-delete-config didn't succeed on first boot"
fi
if [ $(systemctl is-active coreos-ignition-delete-config ||:) != active ]; then
fatal "coreos-ignition-delete-config didn't succeed on first boot"
fi
ok "First boot OK"
rm /var/lib/coreos-ignition-delete-config.stamp
/tmp/autopkgtest-reboot upgrade
;;
upgrade)
if [ ! -e /run/ignition-rmcfg-ran ]; then
fatal "mocked ignition-rmcfg did not run on upgrade boot"
fi
if [ $(systemctl is-active ignition-delete-config ||:) != inactive ]; then
fatal "ignition-delete-config ran on upgrade boot"
fi
if [ $(systemctl is-active coreos-ignition-delete-config ||:) != active ]; then
fatal "coreos-ignition-delete-config didn't succeed on upgrade boot"
fi
ok "Upgrade boot OK"
/tmp/autopkgtest-reboot steady-state
;;
steady-state)
if [ -e /run/ignition-rmcfg-ran ]; then
fatal "mocked ignition-rmcfg ran on steady-state boot"
fi
if [ $(systemctl is-active ignition-delete-config ||:) != inactive ]; then
fatal "ignition-delete-config ran on steady-state boot"
fi
if [ $(systemctl is-active coreos-ignition-delete-config ||:) != inactive ]; then
fatal "coreos-ignition-delete-config ran on steady-state boot"
fi
ok "Steady-state boot OK"
rm /var/lib/coreos-ignition-delete-config.stamp
systemctl mask ignition-delete-config.service
/tmp/autopkgtest-reboot masked
;;
masked)
if [ -e /run/ignition-rmcfg-ran ]; then
fatal "mocked ignition-rmcfg ran on masked boot"
fi
if [ $(systemctl is-active ignition-delete-config ||:) != inactive ]; then
fatal "ignition-delete-config ran on masked boot"
fi
if [ $(systemctl is-active coreos-ignition-delete-config ||:) != inactive ]; then
fatal "coreos-ignition-delete-config ran on masked boot"
fi
ok "Masked unit OK"
;;
*) fatal "unexpected mark: ${AUTOPKGTEST_REBOOT_MARK}" ;;
esac