ci: run the Postgres aggregate tests (add a Postgres service)

Open Beginner friendly
#17 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
docker, github-actions, postgresql, python
Domain
ci-cd

Research direction

Start with the unit-test job in the GitHub Actions workflow file and add the postgres:16-alpine service with the env block from the issue. Then find where the tests read CAMPUS_TEST_POSTGRES_URI (the aggregate test module added in PR #16) to confirm the URI matches the service. Done when the Postgres aggregate tests run and pass in CI rather than being skipped.

Written by the indexing model from the issue text.

Description

Problem

PR #16 added TableInterface.aggregate() with 164 test cases that run against a real PostgreSQL when CAMPUS_TEST_POSTGRES_URI is set. CI does not set it, so every one of them is skipped there.

They were run locally against postgres:16-alpine and all passed, on text, TIMESTAMPTZ and TIMESTAMP columns, with results identical to SQLite.

Why it matters

The PostgreSQL and SQLite backends build different SQL for time buckets and percentiles. Only the PostgreSQL run shows that the two agree, and the tables this was built for (spans, on campus.audit) are PostgreSQL in both environments.

Two behaviours are only observable on PostgreSQL:

  • SET LOCAL TIME ZONE 'UTC'. Removing it failed 13 cases on the native TIMESTAMP table, where naive timestamps came out 8 hours off under an Asia/Singapore session.
  • The Postgres error path (sanitize_driver_error).

Proposal

Add a postgres:16-alpine service to the unit-test job and export CAMPUS_TEST_POSTGRES_URI for it. The tests create and drop their own tables and leave the database empty.

services:
  postgres:
    image: postgres:16-alpine
    env:
      POSTGRES_PASSWORD: test
      POSTGRES_DB: campus_test
    ports:
      - 5432:5432
env:
  CAMPUS_TEST_POSTGRES_URI: postgresql://postgres:test@localhost:5432/campus_test
Dominant language
Python
Stars
0
Forks
0
Avg merge
33m
Merged PRs (30d)
13

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.