Skip to content

ci: run postgres integration tests#2637

Draft
jucor wants to merge 1 commit into
spr/edge/90ba0c34from
spr/edge/62486a46
Draft

ci: run postgres integration tests#2637
jucor wants to merge 1 commit into
spr/edge/90ba0c34from
spr/edge/62486a46

Conversation

@jucor

@jucor jucor commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

Make the opt-in Postgres integration tests actually execute in CI, and share
the provisioning path.

  • Refactor tests/poller/test_integration_postgres.py to obtain its DB via the
    shared require_polis_postgres() helper (introduced in the T2 commit) instead
    of its own inline throwaway-docker fixture on fixed port 5435. It now applies
    000000 + 000006 and uses an ephemeral port (xdist-safe), or the CI service.
  • python-ci.yml step 6: export POLIS_TEST_POSTGRES_URL pointing at the compose
    postgres service (docker-compose.test.yml), whose image already bakes the
    polis migrations via docker-entrypoint-initdb.d — so the votes /
    votes_latest_unique schema + on_vote_insert_update_unique_table rule are
    present (equivalent to an explicit migration-apply step). Also copy
    delphi/scripts into the container so tests/test_generator_vote_copy.py can
    import the cold-start generator under test.

With POLIS_TEST_POSTGRES_URL set, require_polis_postgres verifies the schema and
yields the URL (no docker-in-docker needed); both integration tests then RUN
rather than self-skip.

Verified locally against a shared migrated postgres via POLIS_TEST_POSTGRES_URL:
tests/poller/test_integration_postgres.py ... PASSED
tests/test_generator_vote_copy.py ... PASSED (2 passed in 0.84s)

commit-id:62486a46


Stack:


⚠️ Part of a stack created by spr. Do not merge manually using the UI - doing so may have unexpected results.

@jucor
jucor marked this pull request as draft July 18, 2026 13:28
@jucor
jucor changed the base branch from spr/edge/a68106bf to edge July 18, 2026 13:32
@jucor
jucor force-pushed the spr/edge/62486a46 branch 2 times, most recently from 94a5915 to 0e191f5 Compare July 18, 2026 13:35
@jucor
jucor changed the base branch from edge to spr/edge/be96f1da July 18, 2026 13:35
@jucor
jucor changed the base branch from spr/edge/be96f1da to spr/edge/90ba0c34 July 18, 2026 13:37
@jucor
jucor requested a review from Copilot July 21, 2026 08:38
@jucor
jucor force-pushed the spr/edge/62486a46 branch from 0e191f5 to f6f3cf3 Compare July 21, 2026 08:39
@jucor
jucor force-pushed the spr/edge/90ba0c34 branch from 3615b9c to a0e883b Compare July 21, 2026 08:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Delphi CI workflow so the opt-in Postgres integration tests actually execute in GitHub Actions by wiring them to a shared, migrated Postgres service and by refactoring the poller integration test to use the shared Postgres provision/verification helper.

Changes:

  • Refactors delphi/tests/poller/test_integration_postgres.py to obtain its database via require_polis_postgres() rather than provisioning its own fixed-port Postgres container.
  • Updates .github/workflows/python-ci.yml to export POLIS_TEST_POSTGRES_URL inside the Delphi test container and to copy delphi/scripts into the container for the generator integration test.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
delphi/tests/poller/test_integration_postgres.py Switches the integration test to the shared require_polis_postgres() provisioning/verification path.
.github/workflows/python-ci.yml Exports POLIS_TEST_POSTGRES_URL for integration tests and attempts to stage generator scripts into the CI test container.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +102 to +103
echo "Copying scripts/ (cold-start generator under integration test) into container..."
docker compose -f docker-compose.test.yml cp delphi/scripts delphi:/app/scripts
@jucor
jucor force-pushed the spr/edge/90ba0c34 branch from a0e883b to c237ef1 Compare July 21, 2026 08:45
@jucor
jucor force-pushed the spr/edge/62486a46 branch from f6f3cf3 to 51ddf2e Compare July 21, 2026 08:45
Make the opt-in Postgres integration tests actually execute in CI, and share
the provisioning path.

- Refactor tests/poller/test_integration_postgres.py to obtain its DB via the
  shared require_polis_postgres() helper (introduced in the T2 commit) instead
  of its own inline throwaway-docker fixture on fixed port 5435. It now applies
  000000 + 000006 and uses an ephemeral port (xdist-safe), or the CI service.
- python-ci.yml step 6: export POLIS_TEST_POSTGRES_URL pointing at the compose
  `postgres` service (docker-compose.test.yml), whose image already bakes the
  polis migrations via docker-entrypoint-initdb.d — so the votes /
  votes_latest_unique schema + on_vote_insert_update_unique_table rule are
  present (equivalent to an explicit migration-apply step). Also copy
  delphi/scripts into the container so tests/test_generator_vote_copy.py can
  import the cold-start generator under test.

With POLIS_TEST_POSTGRES_URL set, require_polis_postgres verifies the schema and
yields the URL (no docker-in-docker needed); both integration tests then RUN
rather than self-skip.

Verified locally against a shared migrated postgres via POLIS_TEST_POSTGRES_URL:
  tests/poller/test_integration_postgres.py ... PASSED
  tests/test_generator_vote_copy.py ... PASSED   (2 passed in 0.84s)

commit-id:62486a46
@jucor
jucor force-pushed the spr/edge/90ba0c34 branch from c237ef1 to 3c4d7ca Compare July 21, 2026 11:11
@jucor
jucor force-pushed the spr/edge/62486a46 branch from 51ddf2e to a692657 Compare July 21, 2026 11:11
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.

2 participants