Skip to content

Run the test suite on every pull request - #34

Merged
artem-pplx merged 4 commits into
mainfrom
ci/pr-tests
Nov 18, 2026
Merged

artem-pplx merged 4 commits into
mainfrom
ci/pr-tests

Conversation

@artem-pplx

@artem-pplx artem-pplx commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Why

The test suite only runs in CircleCI (.circleci/config.yml), and CircleCI isn't connected to this repository. Pull requests here report no checks and merge with no tests run, as #33 did.

Change

Adds .github/workflows/tests.yml, run on every pull request and on pushes to main:

  • test: builds pgcat and the plugin examples with --features test-plugins, runs the allocator build check, cargo test --features test-plugins, the two Go cancellation tests, and the Python tests that start their own pgcat (with PGCAT_TEST_PLUGINS=1 and psql 18 from apt.postgresql.org), all against one postgres:14. The Go tests run before the Python tests, so a Python failure doesn't skip them. test_auth.py, test_pgcat.py and test_asyncpg.py need the CircleCI multi-server setup and stay excluded.
  • rustfmt: cargo fmt --check for the workspace and tests/rust.
  • image: builds Dockerfile and Dockerfile.dev, checks that each serves SELECT 1 with its shipped config, and that each exits with exitcode::CONFIG on a config naming an unregistered plugin.

Actions are pinned by SHA, which the repository requires. Superseded pull request runs are cancelled.

Updates test_copy.py, test_plugin_hooks.py and test_sql_observer.py expectations that went stale with the sqlparser upgrades (#27, #29). They never ran in CI, so the break went unseen. The updates don't change pgcat's behavior:

  • COPY t FROM STDIN now parses, so table_access refuses a gated table with 42501, not 0A000 as unparsed.
  • SELECT * FROM ONLY t now names t, so table_access refuses it with 42501. INSERT INTO ONLY t, still read as a table named ONLY, is the case refused unparsed.
  • RESET ALL now parses, so the SQL observer counts it as a statement instead of as an unparsed gap: under the caller's identity when executed in the extended protocol, and without one as a simple Query, which forgets the identity before it runs. The identity is still cleared.

Not in this PR

  • .circleci/ is left as is.
  • Making these checks required is a ruleset change (main ruleset), not a file change. It can be done once this workflow has run green on main.

Created with Perplexity

Only CircleCI ran the tests, and it isn't connected to this repository,
so pull requests merged with no tests run. tests.yml runs formatting,
the build, Rust unit tests, the self-contained Python tests, the Go
cancellation tests and the release images on every pull request and on
main.

Co-authored-by: Perplexity <noreply@perplexity.ai>
The Python tests were written against sqlparser 0.52 and didn't run on
pull requests, so three expectations went stale with the upgrades:

- 0.62 reads COPY ... FROM STDIN at the end of the query, so table_access
  refuses a gated table with 42501 instead of the query being refused
  unparsed with 0A000.
- 0.64 reads ONLY in FROM as the inheritance marker, so
  `SELECT * FROM ONLY t` names t and table_access refuses it with 42501.
  `INSERT INTO ONLY t` is still read as a table named ONLY, so use it as
  the case refused unparsed.
- 0.64 parses RESET, so an executed RESET ALL is counted under the
  identity it ran with instead of as an unparsed gap. The identity is
  still cleared.

Co-authored-by: Perplexity <noreply@perplexity.ai>
A simple Query that clears the identity forgets it before the query is
parsed and counted, so the SQL observer counts it as absent. In the
extended protocol the reset applies once the statement has run, so it's
counted as present.

Co-authored-by: Perplexity <noreply@perplexity.ai>

@artem-pplx artem-pplx left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Verdict at e1fae411: clear, no blockers. CI is green in run 44377819503: 296 Python tests passed, 14 xfailed, both Go cancellation tests passed, and rustfmt and both images passed.

  • tests.yml is unchanged since 9f47551a, the commit this review read in full.
  • Nonblocking, worth fixing before these checks become required:
    • The test binary depends on the allocator script's feature build (inline at line 53).
    • The Go tests are skipped whenever Python fails (inline at line 95).
  • Smaller items are inline: persist-credentials, the disk-usage steps, the cache key, concurrency, and apt-get update.
  • Checked and correct:
    • The Python exclusions are exactly the three files that need the multi-server CircleCI setup.
    • The 1.97.1 toolchain matches Dockerfile and rust-version.
    • The image job's port, config and exit-code-78 assumptions hold.
    • Every sleep 1 is inside a bounded readiness loop followed by a hard check.
    • The four action SHAs match their tag comments.
    • Safe for a public repo: a pull_request trigger, contents: read, no secrets, no pull_request_target.
  • Test-expectation commits (b5f6a67d, e1fae411):
    • On 9f47551a the 3 failures came from main's behaviour after the parser upgrades, not from the workflow. The environment was sound: 293 passed, 0 skipped.
    • The updated expectations match main. COPY t FROM STDIN and SELECT … FROM ONLY t are now parsed and refused by the table check (42501). INSERT INTO ONLY t is still refused as unparsed (0A000), per src/query_router.rs:567-571. Every case that expected a refusal still expects one.
    • The RESET ALL observer labels match reset_session in src/client.rs: present for the extended protocol and absent for the simple protocol.

Description (nonblocking).

  • It says "test: cargo build, the allocator build check, cargo test --features test-plugins, the Python tests …, and the Go cancellation tests." The Python and Go tests rely on the allocator check's feature build, and the Go tests run only when every earlier step passes.
  • Suggested wording after the fixes: "test: builds pgcat and the plugin examples with --features test-plugins, runs the allocator build check, cargo test --features test-plugins, the Python tests that start their own pgcat (with PGCAT_TEST_PLUGINS=1 and psql 18 from apt.postgresql.org), and the two Go cancellation tests, all against one postgres:14."
  • The description also doesn't mention the three updated Python expectations. Suggested line under "Change": "Updates test_copy.py, test_plugin_hooks.py and test_sql_observer.py expectations that went stale with the sqlparser upgrades (#27, #29). They never ran in CI, so the break went unseen."

Limits.

  • One review pass of the workflow by Claude Opus at medium effort, which is allowed because this is CI-only with runtime unchanged. I then checked the expectation delta against the source directly.
  • I read the CI logs and parsed the YAML. I didn't run the suite locally.

Created with Perplexity

Comment thread .github/workflows/tests.yml Resolved
Comment thread .github/workflows/tests.yml Resolved
Comment thread .github/workflows/tests.yml Resolved
Comment thread .github/workflows/tests.yml Resolved
Comment thread .github/workflows/tests.yml Resolved
Comment thread .github/workflows/tests.yml Resolved
Comment thread .github/workflows/tests.yml Resolved

Copy link
Copy Markdown
Collaborator Author

Follow-ups outside this PR (not blocking):

  • Port cargo clippy --lib --examples -- -Dwarnings from .circleci/config.yml:68 as a cheap extra job.
  • Port or retire the CircleCI multi-server suite (test_auth.py, test_pgcat.py, test_asyncpg.py, Ruby, pgbench), and decide whether .circleci/ stays.
  • Pin Dockerfile.dev's floating cargo-chef:latest-rust-1 base to the 1.97.1 toolchain.
  • Make these checks required in the main ruleset once they're green (already noted in the PR body).

Created with Perplexity

The Python and Go tests run target/debug/pgcat, and the plugin tests
need it built with test-plugins. It only had the feature because the
allocator check rebuilt it. Build it, the other binaries and the
examples with the feature directly.

Run the Go cancellation tests before the Python tests, so a Python
failure no longer skips them.

Also drop the checkout's persisted credentials, the mid-job disk usage
step and the constants repeated in the cache key, cancel superseded pull
request runs, and update the apt lists before installing psql.

Co-authored-by: Perplexity <noreply@perplexity.ai>

Copy link
Copy Markdown
Collaborator Author

Delta e1fae411...0972ae9e: clear. The delta changes only tests.yml and addresses all 7 inline items from review 5963385196.

  • The build uses --features test-plugins --bins --examples.
  • The Go steps run before Python, and run 44378953120 shows both Go tests passing.
  • The test checkout uses persist-credentials: false.
  • There's one if: always() disk-usage step, at the end.
  • The cache key is simplified.
  • concurrency cancels superseded runs only on pull_request.
  • apt-get update runs before the psql install.

The description now matches the head. Run 44378953120 is green: Python 296 passed with 14 xfailed, both Go tests passed, and rustfmt and both images passed. The ledger items stay as follow-ups.

Delta checked directly by the coordinating reviewer (Claude Opus), on top of the earlier single medium-effort pass. Comment-only.

Created with Perplexity

@artem-pplx
artem-pplx merged commit cdcfcb6 into main Nov 18, 2026
10 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.

2 participants