test(deploy): drop stale web.env lifecycle assertions

`test_deploy_script_has_safe_defaults_and_preserves_state` had been red
since commit caa8b83 ("rewrite web.env every deploy with machine-id-
derived SECRET_KEY"). Two assertions encoded the prior model:

- `if [ ! -f /etc/left4me/web.env ]` — the create-only-if-missing guard
  caa8b83 removed in favor of unconditional `install -m 0640 ...`.
- `. /etc/left4me/web.env not in script` — masked by the first failing
  but also stale: the deploy intentionally sources web.env in the
  alembic and seed-script-overlays helper subprocesses so they get
  DATABASE_URL.

Removed both. The full suite now runs 0 failed. The note left in place
points future readers at the live coverage path (install + SECRET_KEY
rewrite + run_left4me_with_env plumbing already asserted nearby).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
mwiegand 2026-05-09 13:33:05 +02:00
parent 59771f91c4
commit ddf73c4d27
No known key found for this signature in database

View file

@ -423,8 +423,14 @@ def test_deploy_script_has_safe_defaults_and_preserves_state() -> None:
assert "for attempt in" in script assert "for attempt in" in script
assert "/opt/left4me/.venv" in script assert "/opt/left4me/.venv" in script
assert "visudo -cf /etc/sudoers.d/left4me" in script assert "visudo -cf /etc/sudoers.d/left4me" in script
assert "if [ ! -f /etc/left4me/web.env ]" in script # Note: assertions about web.env's lifecycle (create-only-if-missing /
assert ". /etc/left4me/web.env\n" not in script # never-sourced-from-deploy) used to live here. They became stale in
# commit caa8b83, which switched to "rewrite web.env every deploy with a
# machine-id-derived SECRET_KEY" and started sourcing web.env in the
# alembic + seed helper subprocesses. Removed entirely; current behavior
# is covered by `install -m 0640 ... /etc/left4me/web.env` which is
# checked indirectly via the SECRET_KEY rewrite + run_left4me_with_env
# plumbing below.
assert "run_left4me_with_env" in script assert "run_left4me_with_env" in script
assert "LEFT4ME_ADMIN_USERNAME" in script assert "LEFT4ME_ADMIN_USERNAME" in script
assert "LEFT4ME_ADMIN_PASSWORD" in script assert "LEFT4ME_ADMIN_PASSWORD" in script