Files
777638ae05 Adapt OS update test to Supervisor no longer auto-rebooting (#4906)
* Adapt OS update test to Supervisor no longer auto-rebooting

Since Supervisor 2026.07 (home-assistant/supervisor#6982) a successful
/os/update no longer reboots the host automatically. It installs the
bundle to the other slot, marks it as the pending boot slot (exposed as
"version_pending", see home-assistant/supervisor#7006) and raises a
reboot-required repair issue, leaving the actual reboot to the user.

test_os_update still waited for an immediate "Booting `Slot " right after
`ha os update`, so when run against a 2026.07+ Supervisor it timed out and
failed (cascading into test_supervisor). This is why the QEMU test job
started failing on the dev builds built after 2026-06-30.

Adapt the test to the new flow:
- run `ha os update` and wait until the update is installed as pending
  (version_pending == target), retrying only while the OTA URL is not
  available yet; re-requesting an already-installed version is rejected.
- apply the pending update with `ha host reboot` and wait for the new
  slot to boot.
- assert the new version is running and nothing is pending anymore.

Verified end-to-end in QEMU against the current dev image with the latest
Supervisor: the update stages to slot B (version_pending=18.1, still
booted on A), `ha host reboot` boots slot B, and afterwards version=18.1
with version_pending cleared.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* test_os_update: address review feedback on the update poll loop

- Bound the retry loop and fail with the last `ha os update` output instead
  of relying on the global test timeout when the update never installs.
- Tolerate a transient `ha os info` CLI failure (|| true + defensive JSON
  parse), matching the pattern already used in test_init.
- Use dict.get() for the post-reboot version_pending assertion.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* test_os_update: harden update poll against null data and timeout budget

- `ha os info --raw-json` returns "data": null on an error result; coerce it
  to an empty dict so the version_pending lookup can't raise AttributeError.
- Lower the per-attempt timeout to 120s and the retry count to 4 so the
  loop's worst case stays within the test's 600s timeout budget.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-18 20:05:31 +02:00
..