Skip to content

Commit f991f2c

Browse files
committed
tests/kola: add soft-reboot test for LUKS root encryption
Validate that soft-reboot works correctly when the root filesystem is on a LUKS device. This exercises the x-initrd.attach crypttab option added in coreos/ignition#2219.
1 parent 4f20f5b commit f991f2c

3 files changed

Lines changed: 55 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../config.ign
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../data
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
## kola:
3+
## # This test reprovisions the rootfs.
4+
## tags: "platform-independent reprovision"
5+
## # Root reprovisioning requires at least 4GiB of memory.
6+
## minMemory: 4096
7+
## # A TPM backend device is not available on s390x to support TPM.
8+
## architectures: "! s390x"
9+
## # This test includes a lot of disk I/O and needs a higher
10+
## # timeout value than the default.
11+
## timeoutMin: 15
12+
## description: Verify that soft-reboot works with LUKS root encryption.
13+
14+
set -xeuo pipefail
15+
16+
# shellcheck disable=SC1091
17+
. "$KOLA_EXT_DATA/commonlib.sh"
18+
19+
case "${AUTOPKGTEST_REBOOT_MARK:-}" in
20+
"")
21+
srcdev=$(findmnt -nvr /sysroot -o SOURCE)
22+
[[ ${srcdev} == /dev/mapper/myluksdev ]]
23+
24+
blktype=$(lsblk -o TYPE "${srcdev}" --noheadings)
25+
[[ ${blktype} == crypt ]]
26+
27+
fstype=$(findmnt -nvr /sysroot -o FSTYPE)
28+
[[ ${fstype} == xfs ]]
29+
ok "root is XFS on LUKS device"
30+
31+
# Verify crypttab contains x-initrd.attach
32+
if ! grep -q x-initrd.attach /etc/crypttab; then
33+
fatal "x-initrd.attach not found in /etc/crypttab"
34+
fi
35+
ok "crypttab contains x-initrd.attach"
36+
37+
/tmp/autopkgtest-soft-reboot soft-rebooted
38+
;;
39+
40+
soft-rebooted)
41+
srcdev=$(findmnt -nvr /sysroot -o SOURCE)
42+
[[ ${srcdev} == /dev/mapper/myluksdev ]]
43+
44+
blktype=$(lsblk -o TYPE "${srcdev}" --noheadings)
45+
[[ ${blktype} == crypt ]]
46+
47+
fstype=$(findmnt -nvr /sysroot -o FSTYPE)
48+
[[ ${fstype} == xfs ]]
49+
ok "soft-reboot successful with LUKS root"
50+
;;
51+
52+
*) fatal "unexpected mark: ${AUTOPKGTEST_REBOOT_MARK}";;
53+
esac

0 commit comments

Comments
 (0)