From 2f1a5771092e699ef893d7e077c4de7be95863dc Mon Sep 17 00:00:00 2001 From: archipelago Date: Wed, 1 Jul 2026 15:11:07 -0400 Subject: [PATCH] fix(tests): installed_required_containers must not fail under set -e MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The prior fix's loop `container_installed "$c" && echo "$c"` makes the function's own exit status the exit status of its LAST array entry. If that entry isn't installed on this node (e.g. required-stack-destructive's array ends with mempool-api, absent on .5), the whole function reports failure even though earlier entries matched fine — and under bats' set -e, `targets="$(installed_required_containers)"` then aborts the test outright. required-stack.bats got lucky (its array happens to end with an installed container) but has the identical latent bug. Caught live on .5's iteration 3 of the multinode-pass gate run. Add explicit `return 0`. Co-Authored-By: Claude Sonnet 5 --- tests/lifecycle/bats/required-stack-destructive.bats | 6 ++++++ tests/lifecycle/bats/required-stack.bats | 2 ++ 2 files changed, 8 insertions(+) diff --git a/tests/lifecycle/bats/required-stack-destructive.bats b/tests/lifecycle/bats/required-stack-destructive.bats index 9d89c113..92945639 100755 --- a/tests/lifecycle/bats/required-stack-destructive.bats +++ b/tests/lifecycle/bats/required-stack-destructive.bats @@ -24,6 +24,12 @@ installed_required_containers() { for c in "${required_containers[@]}"; do container_installed "$c" && echo "$c" done + # Always succeed — under `set -e`, the function's own exit code is that of + # its last statement, so if the last array entry happens to be a container + # NOT installed on this node, the whole function (and any bare + # `x="$(installed_required_containers)"` caller) would spuriously fail even + # though earlier entries matched fine. + return 0 } wait_running() { diff --git a/tests/lifecycle/bats/required-stack.bats b/tests/lifecycle/bats/required-stack.bats index f05f3880..9fa04a86 100644 --- a/tests/lifecycle/bats/required-stack.bats +++ b/tests/lifecycle/bats/required-stack.bats @@ -56,6 +56,8 @@ installed_required_containers() { for c in "${required_containers[@]}"; do container_installed "$c" && echo "$c" done + # Always succeed — see the identical comment in required-stack-destructive.bats. + return 0 } bitcoin_rpc() {