test: golden status and plan output of the bash backend in a bubblewrap sandbox

This commit is contained in:
theupriser committed 2026-10-05 09:58:23 +02:00
1 parent 2ac2b0d5ca
commit 2659009a49
45 files changed
+146

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
# Fake systemctl: enabled units listed in $FIXTURE/enabled-units, active ones in $FIXTURE/active-units.
# Queries answer from those lists; everything else is logged and succeeds.
verb=""; units=()
for argument in "$@"; do
[[ "$argument" == -* ]] && continue
if [[ -z "$verb" ]]; then verb="$argument"; else units+=("$argument"); fi
done
case "$verb" in
is-enabled) for unit in "${units[@]}"; do grep -qx -- "$unit" "$FIXTURE/enabled-units" 2>/dev/null || { echo disabled; exit 1; }; done; echo enabled ;;
is-active) for unit in "${units[@]}"; do grep -qx -- "$unit" "$FIXTURE/active-units" 2>/dev/null || { echo inactive; exit 3; }; done; echo active ;;
*) echo "systemctl $*" >> "${GOLDEN_LOG:-/dev/null}"; exit 0 ;;
esac