diff --git a/hack/altinity-backup-strategy.bats b/hack/altinity-backup-strategy.bats index 2db1f33c6..9b31158d9 100644 --- a/hack/altinity-backup-strategy.bats +++ b/hack/altinity-backup-strategy.bats @@ -205,6 +205,17 @@ run_script() { if grep -q '^POST ' "$tmp/state/requests"; then echo "FAIL: no operation may start on an unreachable sidecar"; false; fi } +@test "restore fails without starting restore_remote when the sidecar never answers" { + tmp=$(mktemp -d) + make_stubs "$tmp/bin" "$tmp/state" + touch "$tmp/state/unreachable" + render_script "$tmp/s.sh" restore myapp + if run_script "$tmp" 2> "$tmp/err"; then echo "FAIL: an unreachable sidecar must fail the Pod"; false; fi + if grep -q '^POST ' "$tmp/state/requests"; then echo "FAIL: no restore may start on an unreachable sidecar"; false; fi + grep -q 'list/remote failed 60 times in a row' "$tmp/err" + [ "$(grep -c '^GET .*/backup/list/remote$' "$tmp/state/requests")" = 60 ] +} + @test "restore fails without starting restore_remote when the sidecar stays busy" { tmp=$(mktemp -d) make_stubs "$tmp/bin" "$tmp/state" diff --git a/packages/system/backupstrategy-controller/templates/strategy-altinity-default.yaml b/packages/system/backupstrategy-controller/templates/strategy-altinity-default.yaml index bbae43349..a176044d6 100644 --- a/packages/system/backupstrategy-controller/templates/strategy-altinity-default.yaml +++ b/packages/system/backupstrategy-controller/templates/strategy-altinity-default.yaml @@ -52,9 +52,9 @@ spec: api="http://${host}:7171" auth="-u ${API_USERNAME}:${API_PASSWORD}" # Every request but the POST is retried on failure, every 5s, - # up to $2 times: once the operation is accepted, a dropped poll - # must not fail the attempt, since the Job retry it causes cannot - # tell a lost poll from a lost operation. + # for $2 attempts in all: once the operation is accepted, a + # dropped poll must not fail the attempt, since the Job retry it + # causes cannot tell a lost poll from a lost operation. api_get() { n=0 while true; do @@ -72,9 +72,9 @@ spec: } # The sidecar answers 423 to a new operation while any other is # in progress, so starting before it is idle burns the attempt. - # The exception is the operation $1 itself already running: an - # earlier attempt of this Job started it and died, and the retry - # takes it over rather than starting it twice. + # The exception is the operation $1 itself already running, as + # left by an earlier attempt of this Job that died: it is taken + # over rather than started twice. wait_turn() { for _ in $(seq 1 60); do if actions=$(curl -fsS ${auth} --max-time 10 "${api}/backup/actions"); then