Skip to content

test: provision integration databases with testcontainers - #29

Merged
fsistemas merged 1 commit into
masterfrom
feature/FRA-269
Jun 25, 2026
Merged

test: provision integration databases with testcontainers#29
fsistemas merged 1 commit into
masterfrom
feature/FRA-269

Conversation

@fsistemas

Copy link
Copy Markdown
Owner

Summary

The real-database integration suite (PostgreSQL + MySQL) now provisions ephemeral databases in code with testcontainers by default, alongside the existing docker-compose path. A bare uv run --extra integration pytest -m integration now just works against any running Docker/Podman — no pre-provisioned stack required.

Changes

  • tests/integration/conftest.py — session-scoped pg_url / mysql_url fixtures start postgres:16-alpine / mysql:8.0, seed the demo sales table from docker/initdb.sql, and tear the containers down. The SQL2JSON_TEST_PG_URL / SQL2JSON_TEST_MYSQL_URL overrides still win (reuse an external/compose DB, no seeding). Tests skip cleanly when no container runtime or driver is available. TESTCONTAINERS_RYUK_DISABLED=true is set automatically (Ryuk is flaky under rootless Podman; containers are stopped explicitly).
  • pyproject.tomltestcontainers[postgres,mysql]>=4.0 added to the test-only integration extra (not core deps). Marker description updated.
  • scripts/test-integration.sh — exports the override URLs so the compose stack is reused instead of starting nested testcontainers.
  • .github/workflows/ci.yml — the integration job now runs the bare testcontainers path, so CI validates the new code on every run. Unit + integration both run in CI.
  • DocsCLAUDE.md, README.md, CHANGELOG.md updated.

Verification

  • Integration suite (testcontainers, overrides unset): 24 passed — 12 pg + 12 mysql.
  • uv run pytest: 183 passed, 24 deselected.
  • flake8, black --check, mypy: clean.
  • Coverage: 94.49% (gate 90%).

The PostgreSQL/MySQL integration suite now spins up ephemeral containers in
code by default, so `pytest -m integration` needs no docker-compose stack.
Set SQL2JSON_TEST_*_URL to reuse an external DB; test-integration.sh uses
those overrides to drive compose. CI runs the testcontainers path.
@fsistemas
fsistemas merged commit b4dba01 into master Jun 25, 2026
6 checks passed
@fsistemas
fsistemas deleted the feature/FRA-269 branch June 25, 2026 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant