feat: opt-in Docker-based Gitea integration test suite (#66) #97

Merged
sysadmin merged 1 commits from feat/issue-66-docker-gitea-integration into master 2026-07-02 15:31:57 -05:00
Owner

Implements #66. Optional real-Gitea integration suite — skipped by default, unit tests untouched.

Summary

  • Opt-in only: GITEA_INTEGRATION=1 (documented); without it the suite skips with zero network/Docker requirements.
  • Pinned, disposable container: gitea/gitea:1.22.6 via tests/integration/docker-compose.yml (host port 3003, named volume).
  • Harness: tests/integration/gitea-integration up|token|down — wait-until-ready startup, idempotent TEST-ONLY admin + token printed once to stdout (never written to disk), full teardown including volume.
  • Seed/cleanup: one uniquely-named disposable repo per session (inttest-<8 hex>), created and deleted via API; nothing outside it touched.
  • Coverage (6 tests, all through the shared api_request/api_get_all client per #65/#67 shape): issue listing + multi-page pagination walk; overall limit honored across pages; PR listing (real PR created via contents API); targeted label add/remove leaves other labels intact; bad-token 401 fails closed without echoing the credential; real 404 error payload surfaces as a safe redacted RuntimeError.

Files changed

  • tests/integration/__init__.py, conftest.py, test_gitea_live.py (new)
  • tests/integration/docker-compose.yml, gitea-integration, README.md (new)
  • docs/developer-testing-guidelines.md (section 8: planned → implemented, +link)

Validation

  • python3 -m py_compile conftest + test module — OK (no other Python changed)
  • bash -n tests/integration/gitea-integration — OK
  • Default suite pytest tests/ -q355 passed, 6 skipped (unit behavior byte-identical; integration skips with no network)
  • Live verification: container started from the pinned image, token generated, GITEA_INTEGRATION=1 pytest tests/integration/ -q6 passed (0.81s); container + volume torn down after
  • git diff --check — clean
  • Staged-diff secret sweep — clean (container-local TEST-ONLY admin password is documented as such; the API token exists only in env/stdout)

Risks / follow-up

  • Image pin (1.22.6) will age; bump deliberately when targeting newer Gitea API behavior.
  • single-branch PR test assumes main as the container's default branch (true for pinned image defaults).
  • Review/merge-eligibility live coverage (multi-user) deferred — needs a second non-admin test user; noted in #66 as "where feasible".

Confirmations

  • No secrets committed; no production credentials used or usable by design.
  • No release/tag changes (v1.1.0 untouched), no changes to PR #64 or release notes.

Closes #66.

LLM Handoff Metadata:

  • LLM-Agent-SHA: llm-2add89f8a617
  • LLM-Role: implementer
  • Authenticated-Gitea-User: jcwalker3
  • MCP-Profile: gitea-default (PR created via MCP as sysadmin session; branch authored via jcwalker3 CLI)
  • Branch: feat/issue-66-docker-gitea-integration
  • Worktree: branches/feat-issue-66-docker-gitea-integration
  • Self-review allowed: no

🤖 Generated with Claude Code

Implements #66. Optional real-Gitea integration suite — **skipped by default**, unit tests untouched. ## Summary - **Opt-in only:** `GITEA_INTEGRATION=1` (documented); without it the suite skips with zero network/Docker requirements. - **Pinned, disposable container:** `gitea/gitea:1.22.6` via `tests/integration/docker-compose.yml` (host port 3003, named volume). - **Harness:** `tests/integration/gitea-integration up|token|down` — wait-until-ready startup, idempotent TEST-ONLY admin + token printed once to stdout (never written to disk), full teardown including volume. - **Seed/cleanup:** one uniquely-named disposable repo per session (`inttest-<8 hex>`), created and deleted via API; nothing outside it touched. - **Coverage (6 tests, all through the shared `api_request`/`api_get_all` client per #65/#67 shape):** issue listing + multi-page pagination walk; overall `limit` honored across pages; PR listing (real PR created via contents API); targeted label add/remove leaves other labels intact; bad-token 401 fails closed **without echoing the credential**; real 404 error payload surfaces as a safe redacted `RuntimeError`. ## Files changed - `tests/integration/__init__.py`, `conftest.py`, `test_gitea_live.py` (new) - `tests/integration/docker-compose.yml`, `gitea-integration`, `README.md` (new) - `docs/developer-testing-guidelines.md` (section 8: planned → implemented, +link) ## Validation - `python3 -m py_compile` conftest + test module — OK (no other Python changed) - `bash -n tests/integration/gitea-integration` — OK - Default suite `pytest tests/ -q` — **355 passed, 6 skipped** (unit behavior byte-identical; integration skips with no network) - **Live verification:** container started from the pinned image, token generated, `GITEA_INTEGRATION=1 pytest tests/integration/ -q` — **6 passed** (0.81s); container + volume torn down after - `git diff --check` — clean - Staged-diff secret sweep — clean (container-local TEST-ONLY admin password is documented as such; the API token exists only in env/stdout) ## Risks / follow-up - Image pin (1.22.6) will age; bump deliberately when targeting newer Gitea API behavior. - `single`-branch PR test assumes `main` as the container's default branch (true for pinned image defaults). - Review/merge-eligibility live coverage (multi-user) deferred — needs a second non-admin test user; noted in #66 as "where feasible". ## Confirmations - No secrets committed; no production credentials used or usable by design. - No release/tag changes (v1.1.0 untouched), no changes to PR #64 or release notes. Closes #66. LLM Handoff Metadata: - LLM-Agent-SHA: llm-2add89f8a617 - LLM-Role: implementer - Authenticated-Gitea-User: jcwalker3 - MCP-Profile: gitea-default (PR created via MCP as sysadmin session; branch authored via jcwalker3 CLI) - Branch: feat/issue-66-docker-gitea-integration - Worktree: branches/feat-issue-66-docker-gitea-integration - Self-review allowed: no 🤖 Generated with [Claude Code](https://claude.com/claude-code)
sysadmin added 1 commit 2026-07-02 15:12:21 -05:00
Adds tests/integration/: an optional real-Gitea suite, skipped by default,
enabled only by GITEA_INTEGRATION=1.

- docker-compose.yml pins gitea/gitea:1.22.6 (disposable container, port 3003)
- gitea-integration helper: up (wait-ready) / token (test-only admin, token to
  stdout only) / down (removes container + volume)
- conftest.py: session fixtures; unique disposable seed repo (inttest-<hex>)
  created via API and deleted on teardown
- test_gitea_live.py (6 tests, via shared api_request/api_get_all client):
  issue pagination multi-page walk + overall limit, PR listing, targeted label
  add/remove leaves other labels intact, bad-token 401 fails closed without
  echoing the credential, real 404 payload surfaces as safe redacted error
- README + developer-testing-guidelines section 8 updated (planned -> real)

Default pytest tests/ -q: 355 passed, 6 skipped (unit suite unchanged, no
network). Live verification: 6 passed against the pinned container. No
production credentials; token never logged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sysadmin merged commit 3eff8d1cb3 into master 2026-07-02 15:31:57 -05:00
Sign in to join this conversation.