fix(tests): installed_required_containers must not fail under set -e

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 <noreply@anthropic.com>
This commit is contained in:
archipelago 2026-07-01 15:11:07 -04:00
parent 4c3aa8cc8e
commit 2f1a577109
2 changed files with 8 additions and 0 deletions

View File

@ -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() {

View File

@ -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() {