Skip to content

Add local pytest integration tests for the targetDB CI workflow - #148

Merged
monodera merged 2 commits into
mainfrom
feature/local-db-integration-tests
Aug 4, 2026
Merged

Add local pytest integration tests for the targetDB CI workflow#148
monodera merged 2 commits into
mainfrom
feature/local-db-integration-tests

Conversation

@monodera

@monodera monodera commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a Docker-backed pytest suite (tests/integration/) that reproduces the same pfs-targetdb-cli sequence as .github/workflows/test_database.yml (create-db → q3c → schema → insert example data → prep-fluxstd → transfer/insert targets → insert-pointings → update-catalog-active), so it can be run and debugged locally without pushing to GitHub.
  • Unlike the CI job, which only checks command exit codes, the new tests verify the inserted data with SQL (row counts vs. source CSV/ECSV files, foreign-key linkage, rename-cols behavior, active-flag scoping).
  • tests/docker/ provides a dedicated postgres:16 + Q3C image and compose file (tmpfs data dir, isolated port 15433) so the suite never touches a developer's existing Postgres/examples/docker/ setup.
  • Integration tests are auto-skipped with a clear reason when Docker isn't available, and a --keep-db flag leaves the container running for post-failure inspection.
  • .github/workflows/test_database.yml is unchanged; this is a local-only addition for now.

Test plan

  • uv run pytest tests -v → 22 passed, 1 skipped
  • uv run pytest tests -m "not integration" → integration tests deselected, unit tests still run
  • With docker removed from PATH → all integration tests skip with an explanatory reason; unit tests still pass
  • uv run pytest tests/integration -v --keep-db → container stays up and reachable afterwards; manually torn down with docker compose -f tests/docker/docker-compose.test.yml down -v
  • docker ps -a / docker volume ls show no leftover resources after a normal run
  • git status clean after a run — examples/data/ is never written to (all generated files go to a pytest tmp dir)

🤖 Generated with Claude Code

monodera and others added 2 commits August 4, 2026 13:52
The Test Database CI workflow was the only way to exercise the full
create-db -> q3c -> schema -> insert pipeline, and it only checked
command exit codes. Add a Docker-backed pytest suite (tests/integration/)
that reproduces the same CLI sequence locally and verifies the inserted
rows via SQL, so this can be run and debugged without pushing to GitHub.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@monodera
monodera merged commit 362f982 into main Aug 4, 2026
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