From 620ce60d00dc3e2642b16dd0699cd3651bd49dff Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 15 Sep 2026 16:15:30 +0100 Subject: [PATCH] fstest: make test server start fail fast when docker run fails The start function was run inside an if condition, where bash ignores errexit, so a failed docker run was not noticed. The script then printed its connection details anyway and the test spent 100 seconds trying to connect before failing with a message that hid the real error. Run start in a subshell with errexit on and check its status explicitly so the failure is reported immediately with docker's error message. (cherry picked from commit 4cf1da0d4f90b1a49c1682dab8b5a8e9e34e92ed) --- fstest/testserver/init.d/run.bash | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fstest/testserver/init.d/run.bash b/fstest/testserver/init.d/run.bash index 4d59569c7..68393200b 100644 --- a/fstest/testserver/init.d/run.bash +++ b/fstest/testserver/init.d/run.bash @@ -49,7 +49,15 @@ case "${1:-}" in if _is_running; then stop || true fi - if ! out="$(start)"; then + # Run start in a subshell with errexit on so a failing command + # (eg docker run) aborts it. The subshell's status is only + # honoured if it is not part of an if/|| condition, as bash + # ignores errexit inside those, so capture it separately. + set +e + out="$(set -e; start)" + start_rc=$? + set -e + if (( start_rc != 0 )); then echo "failed to start" >&2 exit 1 fi