Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/kola/root-reprovision/luks/soft-reboot/config.ign
1 change: 1 addition & 0 deletions tests/kola/root-reprovision/luks/soft-reboot/data
49 changes: 49 additions & 0 deletions tests/kola/root-reprovision/luks/soft-reboot/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash
## kola:
## # This test reprovisions the rootfs.
## tags: "platform-independent reprovision"
## # Root reprovisioning requires at least 4GiB of memory.
## minMemory: 4096
## # A TPM backend device is not available on s390x to support TPM.
## architectures: "! s390x"
## # This test includes a lot of disk I/O and needs a higher
## # timeout value than the default.
## timeoutMin: 15
## description: Verify that soft-reboot works with LUKS root encryption.

set -xeuo pipefail

# shellcheck disable=SC1091
. "$KOLA_EXT_DATA/commonlib.sh"

case "${AUTOPKGTEST_REBOOT_MARK:-}" in
"")
srcdev=$(findmnt -nvr /sysroot -o SOURCE)
[[ ${srcdev} == /dev/mapper/myluksdev ]]

blktype=$(lsblk -o TYPE "${srcdev}" --noheadings)
[[ ${blktype} == crypt ]]
ok "root is on LUKS device"

# Workaround: manually add x-initrd.attach to crypttab if not
# already present. This can be removed once coreos/ignition#2219

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: since this is intentionally temporary and depends on the ignition PR, could we use the full PR URL here? It'll make it easier for someone cleaning this up later to find the dependency directly.

# is included in the base image.
if ! grep -q x-initrd.attach /etc/crypttab; then
sed -i '/^myluksdev /s/$/,x-initrd.attach/' /etc/crypttab
systemctl daemon-reload
fi

/tmp/autopkgtest-soft-reboot soft-rebooted
;;

soft-rebooted)
srcdev=$(findmnt -nvr /sysroot -o SOURCE)
[[ ${srcdev} == /dev/mapper/myluksdev ]]

blktype=$(lsblk -o TYPE "${srcdev}" --noheadings)
[[ ${blktype} == crypt ]]
ok "soft-reboot successful with LUKS root"
;;

*) fatal "unexpected mark: ${AUTOPKGTEST_REBOOT_MARK}";;
esac
Comment thread
prestist marked this conversation as resolved.