aboutsummaryrefslogtreecommitdiff
path: root/scripts/testing/maint-scenarios/31-fstrim-enable.sh
blob: 2d548a14ae331eaee5fa6bce221a42afbee00917 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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"
}