release 1.15.5: fix devtesting ladder stdin (ssh ate rungs)
This commit is contained in:
parent
b4f5f060cc
commit
56ba5adff6
3 changed files with 57 additions and 42 deletions
|
|
@ -49,19 +49,20 @@ fi
|
|||
: "${SSH_CMD_TIMEOUT:=60}"
|
||||
|
||||
ssh_dt() {
|
||||
# Prefer Host alias; fall back to explicit user@host if config missing
|
||||
# Prefer Host alias; fall back to explicit user@host if config missing.
|
||||
# Always -n: do not read local stdin (ladder while-read must not be drained by ssh).
|
||||
local target="$DEVTESTING_SSH"
|
||||
if ! ssh -G "$target" >/dev/null 2>&1; then
|
||||
target="devtesting@rusty.taler-ops.ch"
|
||||
fi
|
||||
if command -v timeout >/dev/null 2>&1; then
|
||||
timeout "${SSH_CMD_TIMEOUT}" ssh \
|
||||
timeout "${SSH_CMD_TIMEOUT}" ssh -n \
|
||||
-o BatchMode=yes \
|
||||
-o ConnectTimeout="${SSH_CONNECT_TIMEOUT}" \
|
||||
-o StrictHostKeyChecking=accept-new \
|
||||
"$target" "$@"
|
||||
else
|
||||
ssh \
|
||||
ssh -n \
|
||||
-o BatchMode=yes \
|
||||
-o ConnectTimeout="${SSH_CONNECT_TIMEOUT}" \
|
||||
-o StrictHostKeyChecking=accept-new \
|
||||
|
|
@ -254,7 +255,7 @@ else:
|
|||
lines = ["CHF:%s" % fmt(a) for a in amts]
|
||||
out.write_text("\n".join(lines) + "\n")
|
||||
PY
|
||||
n_rungs=$(grep -cE '^CHF:' "$LADDER_FILE" || echo 0)
|
||||
n_rungs_plan=$(grep -cE '^CHF:' "$LADDER_FILE" || echo 0)
|
||||
ladder_sum=$(python3 -c '
|
||||
from decimal import Decimal
|
||||
s=Decimal(0)
|
||||
|
|
@ -265,55 +266,68 @@ for ln in open("'"$LADDER_FILE"'"):
|
|||
print(s)
|
||||
' 2>/dev/null || echo "?")
|
||||
|
||||
info "ladder plan" "steps=${n_rungs} max=CHF:${DEVTESTING_LADDER_MAX} min=CHF:${DEVTESTING_LADDER_MIN} sum≈CHF:${ladder_sum} (synthetic debit geniban each rung)"
|
||||
info "ladder plan" "steps=${n_rungs_plan} max=CHF:${DEVTESTING_LADDER_MAX} min=CHF:${DEVTESTING_LADDER_MIN} sum≈CHF:${ladder_sum} (synthetic debit geniban each rung)"
|
||||
info "ladder funding" "each rung uses geniban debit payto — no real bank withdraw; volume covers max rung CHF:${DEVTESTING_LADDER_MAX}"
|
||||
|
||||
LADDER_OK=0
|
||||
LADDER_FAIL=0
|
||||
LADDER_WARN=0
|
||||
rung=0
|
||||
while IFS= read -r amt || [ -n "$amt" ]; do
|
||||
[ -n "$amt" ] || continue
|
||||
rung=$((rung + 1))
|
||||
subject="mon-fake-ladder-${ts_base}-r${rung}-$$"
|
||||
info "rung ${rung}/${n_rungs}" "amount=${amt} subject=${subject}"
|
||||
if run_fake_incoming "$amt" "$subject" "$credit_payto" "$debit_payto"; then
|
||||
case "$FI_STATUS" in
|
||||
ok_bounce)
|
||||
ok "rung ${rung}" "${amt} · nexus IN + bounce (plumbing OK)"
|
||||
LADDER_OK=$((LADDER_OK + 1))
|
||||
;;
|
||||
ok_in)
|
||||
ok "rung ${rung}" "${amt} · nexus IN recorded"
|
||||
LADDER_OK=$((LADDER_OK + 1))
|
||||
;;
|
||||
ok_cli)
|
||||
ok "rung ${rung}" "${amt} · CLI ok"
|
||||
LADDER_OK=$((LADDER_OK + 1))
|
||||
;;
|
||||
*)
|
||||
warn "rung ${rung}" "${amt} · status=${FI_STATUS}"
|
||||
LADDER_WARN=$((LADDER_WARN + 1))
|
||||
;;
|
||||
esac
|
||||
else
|
||||
fail "rung ${rung}" "${amt} · ${FI_STATUS}" "$(printf '%s' "$FI_FLAT" | head -c 180)"
|
||||
LADDER_FAIL=$((LADDER_FAIL + 1))
|
||||
if [ "${DEVTESTING_LADDER_STOP_ON_FAIL}" = "1" ]; then
|
||||
warn "ladder stop" "DEVTESTING_LADDER_STOP_ON_FAIL=1 after rung ${rung}"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done <"$LADDER_FILE"
|
||||
# Load amounts into an array first — never `while read … done <file` around ssh:
|
||||
# without ssh -n, OpenSSH drains the ladder file as remote stdin (only rung 1 ran).
|
||||
mapfile -t LADDER_AMTS < <(grep -E '^CHF:' "$LADDER_FILE" || true)
|
||||
rm -f "$LADDER_FILE"
|
||||
n_rungs=${#LADDER_AMTS[@]}
|
||||
if [ "$n_rungs" -eq 0 ]; then
|
||||
fail "ladder" "no CHF: amounts generated"
|
||||
else
|
||||
for amt in "${LADDER_AMTS[@]}"; do
|
||||
[ -n "$amt" ] || continue
|
||||
rung=$((rung + 1))
|
||||
subject="mon-fake-ladder-${ts_base}-r${rung}-$$"
|
||||
info "rung ${rung}/${n_rungs}" "amount=${amt} subject=${subject}"
|
||||
if run_fake_incoming "$amt" "$subject" "$credit_payto" "$debit_payto"; then
|
||||
case "$FI_STATUS" in
|
||||
ok_bounce)
|
||||
ok "rung ${rung}" "${amt} · nexus IN + bounce (plumbing OK)"
|
||||
LADDER_OK=$((LADDER_OK + 1))
|
||||
;;
|
||||
ok_in)
|
||||
ok "rung ${rung}" "${amt} · nexus IN recorded"
|
||||
LADDER_OK=$((LADDER_OK + 1))
|
||||
;;
|
||||
ok_cli)
|
||||
ok "rung ${rung}" "${amt} · CLI ok"
|
||||
LADDER_OK=$((LADDER_OK + 1))
|
||||
;;
|
||||
*)
|
||||
warn "rung ${rung}" "${amt} · status=${FI_STATUS}"
|
||||
LADDER_WARN=$((LADDER_WARN + 1))
|
||||
;;
|
||||
esac
|
||||
else
|
||||
fail "rung ${rung}" "${amt} · ${FI_STATUS}" "$(printf '%s' "$FI_FLAT" | head -c 180)"
|
||||
LADDER_FAIL=$((LADDER_FAIL + 1))
|
||||
if [ "${DEVTESTING_LADDER_STOP_ON_FAIL}" = "1" ]; then
|
||||
warn "ladder stop" "DEVTESTING_LADDER_STOP_ON_FAIL=1 after rung ${rung}/${n_rungs}"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
info "ladder summary" "ok=${LADDER_OK} warn=${LADDER_WARN} fail=${LADDER_FAIL} / planned=${n_rungs} · max=CHF:${DEVTESTING_LADDER_MAX}"
|
||||
if [ "$LADDER_FAIL" -gt 0 ] && [ "$LADDER_OK" -eq 0 ]; then
|
||||
if [ "$n_rungs" -eq 0 ]; then
|
||||
:
|
||||
elif [ "$LADDER_FAIL" -gt 0 ] && [ "$LADDER_OK" -eq 0 ]; then
|
||||
fail "ladder" "all rungs failed"
|
||||
elif [ "$LADDER_FAIL" -gt 0 ]; then
|
||||
warn "ladder" "partial failures fail=${LADDER_FAIL} ok=${LADDER_OK}"
|
||||
warn "ladder" "partial failures fail=${LADDER_FAIL} ok=${LADDER_OK}/${n_rungs}"
|
||||
elif [ "$LADDER_OK" -lt "$n_rungs" ]; then
|
||||
# e.g. stdin-eaten loop used to stop after 1 rung with ok=1 fail=0
|
||||
warn "ladder incomplete" "only ${LADDER_OK}/${n_rungs} rungs ran (ok) — not through max CHF:${DEVTESTING_LADDER_MAX}"
|
||||
else
|
||||
ok "ladder complete" "ok=${LADDER_OK} through max CHF:${DEVTESTING_LADDER_MAX}"
|
||||
ok "ladder complete" "ok=${LADDER_OK}/${n_rungs} through max CHF:${DEVTESTING_LADDER_MAX}"
|
||||
fi
|
||||
else
|
||||
info "ladder" "skipped (DEVTESTING_LADDER=0)"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue