Skip to content

Add regression tests for %{BRANCH} interpolation in Postgres and BigQuery importers - #182

Merged
Gerrrr merged 1 commit into
apache:masterfrom
Phoenix1504e:postgres-branch-tests
Oct 28, 2026
Merged

Gerrrr merged 1 commit into
apache:masterfrom
Phoenix1504e:postgres-branch-tests

Conversation

@Phoenix1504e

Copy link
Copy Markdown
Contributor

What

Add unit tests for the %{BRANCH} placeholder interpolation in the
PostgreSQL and BigQuery importers (tests only — no production code
changes).

Why

The interpolation handling introduced in #124 only had error-path
coverage: the suite verified that a query containing %{BRANCH} fails
when --branch is not specified, but nothing asserted the happy path —
the exact query rewrite and the parameters actually passed to the
driver.

This closes the coverage gap I identified while working through #34.

What is tested

  • PostgreSQL: %{BRANCH} is replaced with %s placeholders, one
    query parameter per occurrence, and the resulting Series carries
    the selected branch name.
  • PostgreSQL: multiple occurrences → one parameter each.
  • PostgreSQL: a query without the placeholder is executed with no
    parameters.
  • BigQuery: %{BRANCH} is replaced with the @branch named
    parameter, passed as a single STRING ScalarQueryParameter.

Testing

  • pytest tests/importer_test.py — 29 passed (4 new)
  • pytest tests/ -k "not e2e" — 227 passed (10 e2e tests need Docker,
    unchanged)
  • ruff check, flake8, isort --check-only, autoflake --check —
    all clean

Closes #34

…uery importers

The %{BRANCH} placeholder handling introduced in apache#124 only had error-path
coverage: tests verified that a query containing %{BRANCH} fails when
--branch is not specified, but nothing asserted the happy path.

Add unit tests asserting the exact query rewrite and parameters for both
SQL-backed importers:

- PostgreSQL: %{BRANCH} is replaced with %s placeholders, one query
  parameter per occurrence, and the resulting Series carries the
  selected branch name.
- BigQuery: %{BRANCH} is replaced with the @Branch named parameter,
  passed as a single STRING ScalarQueryParameter.
- A query without %{BRANCH} is executed with no parameters.

Related to apache#34

Signed-off-by: Aditya Pathak <68177924+Phoenix1504e@users.noreply.github.com>
@Gerrrr
Gerrrr merged commit 24ef337 into apache:master Oct 28, 2026
8 checks passed
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.

Feature branch support in Postgres importer

2 participants