aboutsummaryrefslogtreecommitdiff
path: root/scripts/testing/maint-scenarios/31-fstrim-enable.sh
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-07-08 05:45:51 -0500
committerCraig Jennings <c@cjennings.net>2026-07-08 05:45:51 -0500
commitd6993d35368f4733cac7dfd23be354de7ef0a0fb (patch)
tree5b4fb22b66d69bf5851dac0e32614ef958af5378 /scripts/testing/maint-scenarios/31-fstrim-enable.sh
parent26f7ea43ed3ef2dcb088dc4af5eb5881743f6a88 (diff)
downloadarchsetup-d6993d35368f4733cac7dfd23be354de7ef0a0fb.tar.gz
archsetup-d6993d35368f4733cac7dfd23be354de7ef0a0fb.zip
test(maint): add VM and nspawn remedy scenario harness
Nine break/fix/assert scenarios run the real maint fix inside the test VM. The runner batches non-conflicting scenarios into one VM boot, restores the snapshot only between groups, and leaves the base image pristine afterwards. A systemd-nspawn fast lane runs the pacman-level group against a cached pacstrap rootfs in seconds. The plan layer validates the scenario contract without a VM and carries a 19-test unit suite. make test-maint wires the VM lane in. The zfs lane is filtered but unexercised: the FS_PROFILE=zfs base image fails to build (ZFS DKMS module not found on linux-lts 6.18). The failure is tracked in the todo.
Diffstat (limited to 'scripts/testing/maint-scenarios/31-fstrim-enable.sh')
-rw-r--r--scripts/testing/maint-scenarios/31-fstrim-enable.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/testing/maint-scenarios/31-fstrim-enable.sh b/scripts/testing/maint-scenarios/31-fstrim-enable.sh
new file mode 100644
index 0000000..2d548a1
--- /dev/null
+++ b/scripts/testing/maint-scenarios/31-fstrim-enable.sh
@@ -0,0 +1,22 @@
+# shellcheck shell=bash disable=SC2034 # sourced by run-maint-scenarios.sh
+# Scenario: fstrim.timer enabled and started from the disabled default.
+#
+# The base image ships util-linux with fstrim.timer disabled — the exact
+# state the metric flags. The remedy is systemctl enable --now.
+SCENARIO_DESC="fstrim.timer enabled and started"
+SCENARIO_GROUP="systemd"
+SCENARIO_PROFILES="btrfs"
+
+scenario_break() {
+ # Default state, but pin it so the scenario stays honest if a future
+ # base image enables the timer.
+ mexec "systemctl disable --now fstrim.timer >/dev/null 2>&1 || true; ! systemctl is-enabled fstrim.timer >/dev/null 2>&1"
+}
+
+scenario_fix() {
+ mfix fstrim_enable
+}
+
+scenario_assert() {
+ mexec "systemctl is-enabled fstrim.timer && systemctl is-active fstrim.timer"
+}