From eccbf482730cda12e1e26b7a48b8d49ce11d3726 Mon Sep 17 00:00:00 2001
From: Julian Sommer <115516918+juliansommer@users.noreply.github.com>
Date: Tue, 20 Oct 2026 10:21:23 +1000
Subject: [PATCH] test: stub sudo so the uninstall multi-node refusal check
runs on any host
---
scripts/uninstall-spx_test.sh | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/scripts/uninstall-spx_test.sh b/scripts/uninstall-spx_test.sh
index 779715bf2..ea94d19f9 100755
--- a/scripts/uninstall-spx_test.sh
+++ b/scripts/uninstall-spx_test.sh
@@ -81,9 +81,15 @@ mkcfg() { # mkcfg
...
mkcfg "$TMP/three" node1 node2 node3
mkcfg "$TMP/one" node1
+# The node count is read through sudo, so a pass-through stub keeps the refusal
+# from depending on whether the machine running this has sudo.
+mkdir "$TMP/bin"
+printf '#!/bin/sh\nexec "$@"\n' > "$TMP/bin/sudo"
+chmod +x "$TMP/bin/sudo"
+
for args in "" "--yes" "--yes --dry-run"; do
# shellcheck disable=SC2086
- SPX_ETC_DIR="$TMP/three" "$UNINSTALL" $args >"$TMP/out" 2>"$TMP/err" && rc=0 || rc=$?
+ PATH="$TMP/bin:$PATH" SPX_ETC_DIR="$TMP/three" "$UNINSTALL" $args >"$TMP/out" 2>"$TMP/err" && rc=0 || rc=$?
label=${args:-"(no flags)"}
[ "$rc" = 1 ] \
&& pass "three-node config refuses with $label" \