diff --git a/tests/kola/root-reprovision/luks/data/luks-test.sh b/tests/kola/root-reprovision/luks/data/luks-test.sh new file mode 100755 index 0000000000..620896b1c2 --- /dev/null +++ b/tests/kola/root-reprovision/luks/data/luks-test.sh @@ -0,0 +1,47 @@ +. $KOLA_EXT_DATA/commonlib.sh + +srcdev=$(findmnt -nvr / -o SOURCE) +[[ ${srcdev} == /dev/mapper/myluksdev ]] + +blktype=$(lsblk -o TYPE "${srcdev}" --noheadings) +[[ ${blktype} == crypt ]] + +fstype=$(findmnt -nvr / -o FSTYPE) +[[ ${fstype} == xfs ]] +ok "source is XFS on LUKS device" + +rootflags=$(findmnt /sysroot -no OPTIONS) +if ! grep prjquota <<< "${rootflags}"; then + fatal "missing prjquota in root mount flags: ${rootflags}" +fi +ok "root mounted with prjquota" + +# while we're here, sanity-check that boot is mounted by UUID +if ! systemctl cat boot.mount | grep -q What=/dev/disk/by-uuid; then + systemctl cat boot.mount + fatal "boot mounted not by UUID" +fi +ok "boot mounted by UUID" + +case "${AUTOPKGTEST_REBOOT_MARK:-}" in + "") + # check that ignition-ostree-growfs ran + if [ ! -e /run/ignition-ostree-growfs.stamp ]; then + fatal "ignition-ostree-growfs did not run" + fi + + # reboot once to sanity-check we can find root on second boot + /tmp/autopkgtest-reboot rebooted + ;; + + rebooted) + grep root=UUID= /proc/cmdline + grep rd.luks.name= /proc/cmdline + ok "found root kargs" + + # while we're here, sanity-check that we have a boot=UUID karg too + grep boot=UUID= /proc/cmdline + ok "found boot karg" + ;; + *) fatal "unexpected mark: ${AUTOPKGTEST_REBOOT_MARK}";; +esac diff --git a/tests/kola/root-reprovision/luks/test.sh b/tests/kola/root-reprovision/luks/test.sh index 2532f65425..25699f8f13 100755 --- a/tests/kola/root-reprovision/luks/test.sh +++ b/tests/kola/root-reprovision/luks/test.sh @@ -14,48 +14,6 @@ set -xeuo pipefail . $KOLA_EXT_DATA/commonlib.sh -srcdev=$(findmnt -nvr / -o SOURCE) -[[ ${srcdev} == /dev/mapper/myluksdev ]] -blktype=$(lsblk -o TYPE "${srcdev}" --noheadings) -[[ ${blktype} == crypt ]] - -fstype=$(findmnt -nvr / -o FSTYPE) -[[ ${fstype} == xfs ]] -ok "source is XFS on LUKS device" - -rootflags=$(findmnt /sysroot -no OPTIONS) -if ! grep prjquota <<< "${rootflags}"; then - fatal "missing prjquota in root mount flags: ${rootflags}" -fi -ok "root mounted with prjquota" - -# while we're here, sanity-check that boot is mounted by UUID -if ! systemctl cat boot.mount | grep -q What=/dev/disk/by-uuid; then - systemctl cat boot.mount - fatal "boot mounted not by UUID" -fi -ok "boot mounted by UUID" - -case "${AUTOPKGTEST_REBOOT_MARK:-}" in - "") - # check that ignition-ostree-growfs ran - if [ ! -e /run/ignition-ostree-growfs.stamp ]; then - fatal "ignition-ostree-growfs did not run" - fi - - # reboot once to sanity-check we can find root on second boot - /tmp/autopkgtest-reboot rebooted - ;; - - rebooted) - grep root=UUID= /proc/cmdline - grep rd.luks.name= /proc/cmdline - ok "found root kargs" - - # while we're here, sanity-check that we have a boot=UUID karg too - grep boot=UUID= /proc/cmdline - ok "found boot karg" - ;; - *) fatal "unexpected mark: ${AUTOPKGTEST_REBOOT_MARK}";; -esac +# run the tests +. $KOLA_EXT_DATA/luks-test.sh