Files
cc-ci/tests/gitea/test_restore.py
autonomic-bot 33561c8609
Some checks failed
continuous-integration/drone/push Build is failing
feat(gtea): build full gitea test suite (M1 build — all files)
- tests/gitea/recipe_meta.py: updated from dep-provider stub to dual-role (dep + recipe-under-test).
  Adds BACKUP_CAPABLE=True, READY_PROBE (/api/v1/version), SCREENSHOT (sign-in page), LFS-
  conditional EXTRA_ENV (compose.lfs.yml + GITEA_LFS_START_SERVER only when RECIPE=gitea AND
  overlay present — dep path unchanged). All existing dep keys preserved; 10/10 dep unit tests pass.

- tests/gitea/ops.py: NEW — admin user creation via gitea CLI (ci_admin, creds in /tmp per-domain
  file), marker repo lifecycle (pre_install/pre_upgrade/pre_backup create; pre_restore deletes to
  diverge from backup state).

- tests/gitea/test_{install,upgrade,backup,restore}.py: NEW — lifecycle overlays. Install checks
  API + admin auth + Playwright sign-in. Upgrade/backup/restore assert marker repo continuity.

- tests/gitea/custom/: NEW — test_health.py (parity: HTTP 200 root), test_git_push.py (parity:
  create→clone→push→verify→delete), test_admin_api.py (beyond-parity: user+org+token CRUD),
  test_lfs_roundtrip.py (LFS OID round-trip + JWT stability; skips on main, runs on PR #1 head).

- tests/gitea/PARITY.md: NEW — mapping table, source note (recipe-info corpus not upstream repo),
  beyond-parity rationale, backup/restore real-tier note, DB choice, dep-split mechanism, LFS skip.

- machine-docs/STATUS-gtea.md: NEW — phase status (building M1).
- machine-docs/BACKLOG-gtea.md: merged with Adversary init.
- machine-docs/JOURNAL-gtea.md: Builder log with design decisions + unit test results.
- machine-docs/REVIEW-gtea.md: kept Adversary init content.
- machine-docs/DECISIONS.md: appended gtea section (LFS split, admin mgmt, marker design).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-15 19:50:08 +00:00

28 lines
1.0 KiB
Python

"""gitea — RESTORE overlay (phase gtea).
ops.pre_restore DELETED the ci-marker repo (diverged from backup state).
The orchestrator restored from the backup. This overlay ADDS: the marker repo returned
(sqlite3 was restored to the backed-up state). A no-op restore would leave the repo absent.
"""
from __future__ import annotations
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "runner"))
from harness import generic # noqa: E402
sys.path.insert(0, os.path.dirname(__file__))
from ops import admin_creds, marker_repo_exists # noqa: E402
def test_restore_returns_marker_repo(live_app, meta):
"""The ci-marker repo returned after restore (sqlite3 reverted to backed-up state)."""
generic.assert_serving(live_app, meta)
user, password = admin_creds(live_app)
assert marker_repo_exists(live_app, user, password), (
f"{live_app}: ci-marker repo absent after restore — restore did not revert the deletion "
"(sqlite3 not restored to backed-up state)"
)