Skip to content

Add pytest test suite #10

Closed
Closed

Description

@gordonmurray

Repo has no tests. Minimum coverage to add:

  • Connection test happy path against local MinIO (uses existing docker-compose fixtures)
  • Query happy path end-to-end
  • Validator behaviour (see Integrate AWS Glue Data Catalog #2) — valid SELECT accepted, DML rejected, bypass attempts fail
  • _convert_to_iceberg_query handles the documented patterns
  • _limit_query doesn't double-apply LIMIT and doesn't mangle subqueries

Tooling: pytest + httpx.AsyncClient for API tests. A fixture can spin up the backend against the existing MinIO service in docker-compose.yml.

Activity

  1. gordonmurray commented on Apr 15, 2026

    @gordonmurray
    OwnerAuthor

    Pytest suite shipped in PR #24 with 35 unit tests covering the highest-risk guards:

    • _validate_and_limit_sql (sqlglot SELECT-only validator, LIMIT injection, multi-statement rejection)
    • _convert_to_iceberg_query (read_parquet rewriting, REST catalog refs)
    • ConnectionConfig Pydantic validators (SQL injection attempts, control chars, /metadata stripping, identifier patterns)
    • _sql_string_literal (quote doubling, control-char rejection)

    Suite runs in ~0.5s with no DuckDB engine, network, or docker — wired into CI as the Backend tests (pytest) job and added to the required status checks on main.

    The two items from the original scope that didn't land here:

    • Connection / query happy path against local MinIO — currently covered by manual docker compose up --build verification on every PR touching the query path. If we want this hermetic in CI, better scoped as a follow-up (needs MinIO service container + pyiceberg seeding in the GitHub Actions runner).
    • _limit_query — deleted in PR fix(security): replace naive SQL validator with sqlglot AST check #23; replaced by _validate_and_limit_sql which is fully covered.

    Closing as substantively done. Additional coverage will land with #25 (metrics) and #26 (probing) — both of those already have red tests driving them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestqualityCode quality, tests, CI, maintainability

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions