diff --git a/tests/lifecycle/bats/immich.bats b/tests/lifecycle/bats/immich.bats index b3779875..fec60fab 100644 --- a/tests/lifecycle/bats/immich.bats +++ b/tests/lifecycle/bats/immich.bats @@ -47,9 +47,23 @@ teardown_file() { } @test "immich exposes its web UI lan-address (port 2283)" { - run rpc_result container-list - [ "$status" -eq 0 ] - echo "$output" | jq -e '.[] | select(.name == "immich") | .lan_address | test("2283")' >/dev/null + # Poll briefly: lan_address is derived from the published host port, which is + # momentarily absent (null) while immich_server is mid-recreate (e.g. a + # health-monitor bounce during the read-only tier). A genuinely unexposed + # immich never publishes 2283, so this still catches real port drift; it only + # absorbs the transient null seen under churn. + local deadline=$(( $(date +%s) + 30 )) + while (( $(date +%s) < deadline )); do + run rpc_result container-list + [ "$status" -eq 0 ] + if echo "$output" \ + | jq -e '.[] | select(.name == "immich") | .lan_address // "" | test("2283")' >/dev/null; then + return 0 + fi + sleep 3 + done + echo "immich never reported a lan_address containing 2283 within 30s" >&2 + return 1 } # ────────────────────────────────────────────────────────────────────