aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-07-20 23:33:02 -0500
committerCraig Jennings <c@cjennings.net>2026-07-20 23:33:02 -0500
commitcf211cd8dd8dd0ff18673c88a3eef2c63549d6d5 (patch)
tree4051e651241dd4b13d1d57fc70ead7d4099b4ad1 /scripts
parent5ce5d6903b8178e3502f52fcc2723e9cc44766d5 (diff)
downloadarchsetup-cf211cd8dd8dd0ff18673c88a3eef2c63549d6d5.tar.gz
archsetup-cf211cd8dd8dd0ff18673c88a3eef2c63549d6d5.zip
fix(test): count a diagnose miss as a failed net scenario
The scenario_diagnose_expect else-branch printed its FAIL line but never forced a non-zero subshell exit. A scenario whose only failure was the diagnose check counted as passed, so the run printed "all scenarios passed" and exited 0 over a real net-doctor diagnosis regression. The miss now sets a per-scenario rc that carries to the subshell exit. The fix and assert still run first, since the repair result is worth having either way. The new harness drives the real script with stubbed ssh/rsync/jq and a controllable fake scenario, pinning all four check outcomes.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/testing/run-net-scenarios.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/testing/run-net-scenarios.sh b/scripts/testing/run-net-scenarios.sh
index 7197e37..8d27438 100755
--- a/scripts/testing/run-net-scenarios.sh
+++ b/scripts/testing/run-net-scenarios.sh
@@ -100,13 +100,19 @@ for f in "${S_FILES[@]}"; do
esac
echo "== $name — $SCENARIO_DESC"
scenario_break || { fail "$name: break failed"; exit 1; }
+ # A diagnose miss still runs the fix + assert (the repair result is
+ # worth having either way) but must fail the scenario: rc carries it to
+ # the subshell exit so the run can't report green over a diagnosis
+ # regression.
+ rc=0
if declare -F scenario_diagnose_expect >/dev/null; then
if scenario_diagnose_expect; then pass "$name: diagnose named it"
- else fail "$name: diagnose did NOT name it (inspect net doctor --json)"; fi
+ else fail "$name: diagnose did NOT name it (inspect net doctor --json)"; rc=1; fi
fi
scenario_fix || info "$name: net doctor --fix returned non-zero"
if scenario_assert; then pass "$name: repaired"
else fail "$name: NOT repaired"; exit 1; fi
+ exit "$rc"
) || fails=$((fails + 1))
done