Skip to content

Commit

Permalink
tests/kola: add autosave-xfs tests
Browse files Browse the repository at this point in the history
Add a new `ext.config.root-reprovision.autosave-xfs` test that checks
that the logic kicks in on a large enough disk. Add a similar
`ext.config.root-reprovision.luks.autosave-xfs` for the LUKS version
of this.

Sanity-check in other reprovisioning tests that autosave-xfs didn't
kick in.
  • Loading branch information
jlebon committed Apr 6, 2023
1 parent 2248f8b commit 1744c68
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 2 deletions.
7 changes: 6 additions & 1 deletion tests/kola/disks/growfs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## exclusive: false

# This test verifies that the rootfs is automatically grown on first boot in the
# default case.
# default case and that the autosave-xfs logic didn't kick in.

set -xeuo pipefail

Expand All @@ -13,3 +13,8 @@ if [ ! -f /run/ignition-ostree-growfs.stamp ]; then
fatal "rootfs was not grown on first boot"
fi
ok "rootfs grown on first boot"

if [ -f /run/ignition-ostree-autosaved-xfs.stamp ]; then
fatal "unexpected autosaved XFS"
fi
ok "rootfs wasn't automatically reprovisioned"
1 change: 1 addition & 0 deletions tests/kola/root-reprovision/autosave-xfs/data/commonlib.sh
26 changes: 26 additions & 0 deletions tests/kola/root-reprovision/autosave-xfs/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
## kola:
## # This test reprovisions the rootfs automatically.
## tags: "platform-independent reprovision"
## # Trigger automatic XFS reprovisioning
## minDisk: 64
## # Root reprovisioning requires at least 4GiB of memory.
## minMemory: 4096
## # This test includes a lot of disk I/O and needs a higher
## # timeout value than the default.
## timeoutMin: 15

set -xeuo pipefail

. $KOLA_EXT_DATA/commonlib.sh

if [ ! -f /run/ignition-ostree-autosaved-xfs.stamp ]; then
fatal "expected autosaved XFS"
fi
ok "autosaved XFS on large disk"

eval $(xfs_info / | grep -o 'agcount=[0-9]*')
if [ "$agcount" -gt 4 ]; then
fatal "expected agcount of at most 4, got ${agcount}"
fi
ok "low agcount on large disk"
5 changes: 5 additions & 0 deletions tests/kola/root-reprovision/linear/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ case "${AUTOPKGTEST_REBOOT_MARK:-}" in
fatal "ignition-ostree-growfs ran"
fi

# check that autosave-xfs didn't run
if [ -e /run/ignition-ostree-autosaved-xfs.stamp ]; then
fatal "unexpected autosaved XFS"
fi

# reboot once to sanity-check we can find root on second boot
/tmp/autopkgtest-reboot rebooted
;;
Expand Down
1 change: 1 addition & 0 deletions tests/kola/root-reprovision/luks/autosave-xfs/config.ign
1 change: 1 addition & 0 deletions tests/kola/root-reprovision/luks/autosave-xfs/data
34 changes: 34 additions & 0 deletions tests/kola/root-reprovision/luks/autosave-xfs/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/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 suport TPM.
## architectures: "!s390x"
## # This test includes a lot of disk I/O and needs a higher
## # timeout value than the default.
## timeoutMin: 15
## # Trigger automatic XFS reprovisioning
## minDisk: 64

set -xeuo pipefail

. $KOLA_EXT_DATA/commonlib.sh

# check that we ran automatic XFS reprovisioning
if [ -z "${AUTOPKGTEST_REBOOT_MARK:-}" ]; then
if [ ! -f /run/ignition-ostree-autosaved-xfs.stamp ]; then
fatal "expected autosaved XFS"
fi
ok "autosaved XFS on large disk"

eval $(xfs_info / | grep -o 'agcount=[0-9]*')
if [ "$agcount" -gt 4 ]; then
fatal "expected agcount of at most 4, got ${agcount}"
fi
ok "low agcount on large disk"
fi

# run the rest of the tests
. $KOLA_EXT_DATA/luks-test.sh
10 changes: 9 additions & 1 deletion tests/kola/root-reprovision/luks/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,13 @@ set -xeuo pipefail

. $KOLA_EXT_DATA/commonlib.sh

# run the tests
# check that we didn't run automatic XFS reprovisioning
if [ -z "${AUTOPKGTEST_REBOOT_MARK:-}" ]; then
if [ -f /run/ignition-ostree-autosaved-xfs.stamp ]; then
fatal "unexpected autosaved XFS"
fi
ok "no autosaved XFS on large disk"
fi

# run the rest of the tests
. $KOLA_EXT_DATA/luks-test.sh
5 changes: 5 additions & 0 deletions tests/kola/root-reprovision/raid1/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ case "${AUTOPKGTEST_REBOOT_MARK:-}" in
fatal "ignition-ostree-growfs ran"
fi

# check that autosave-xfs didn't run
if [ -e /run/ignition-ostree-autosaved-xfs.stamp ]; then
fatal "unexpected autosaved XFS"
fi

# reboot once to sanity-check we can find root on second boot
/tmp/autopkgtest-reboot rebooted
;;
Expand Down

0 comments on commit 1744c68

Please sign in to comment.