# shellcheck shell=bash disable=SC2034 # sourced by run-maint-scenarios.sh # Scenario: the journal vacuum executes against live journald at the TOML floor. # # What this proves: the TOML edit reaches the remedy's argv (vacuum target # and warn threshold are the same key), journalctl --vacuum-size runs for # real against live journald, and the metric grades ok against the edited # floor afterwards. # # What it deliberately does NOT prove: size reduction. The key is int-GB and # bottoms out at 1, vacuum only touches archived files, and a VM-sized # journal never nears 1 GB — a genuine reduction test would need journald # rate-limit surgery plus ~1 GB of spam per run. A pre/post usage comparison # is also unsound here: journald keeps landing in-flight writes (the spam is # async, and every ssh hop logs), so usage can grow across a correct vacuum. SCENARIO_DESC="journal vacuum runs at the TOML size floor" SCENARIO_GROUP="logs" SCENARIO_PROFILES="any" scenario_break() { mexec "sed -i 's/^journal_disk_warn_gb *=.*/journal_disk_warn_gb = 1/' /root/.config/archsetup/maintenance-thresholds.toml" \ && mexec "for i in \$(seq 1 20); do head -c 900000 /dev/urandom | base64 | systemd-cat -t maint-scenario-spam; done; journalctl --rotate; journalctl --flush >/dev/null 2>&1 || true" } scenario_fix() { mfix journal_vacuum } scenario_assert() { massert_metric journal_disk ok }