Cover verify-results-pgtap.sh's regression.diffs classification - #85
jnasbyupgrade wants to merge 6 commits into
Conversation
Paired with pgxntool commit ec7c7ee, which lets `make results` seed the first expected output for a brand-new test (pgxntool issue #119). New `test/standard/verify-results-pgtap-script.bats` owns the script's decision logic, invoked directly against a scratch directory with no Make, foundation environment or PostgreSQL: the no-baseline exemption, a real mismatch still blocking, an unblessed file holding a SQL error still blocking, unrecognized `regression.diffs` content failing closed, classification driven by unprefixed `diff `/`@@ ` headers rather than diffed content, and the pre-existing `not ok`/TODO/plan-mismatch scan. `make-test.bats` keeps only what needs a real `pg_regress` run: that `make results` really does seed a new test's first expected output end-to-end, and that `make verify-results` invokes the script and propagates its failure. Its TODO and plan-mismatch cases moved to the script-level file rather than paying for a full `make verify-results` run each to re-test logic decided entirely inside the script. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
`make results` blesses every `test/results/*.out` into `test/expected/`, so a leftover `results/brand_new.out` would reappear as an orphaned expected file for `check-stale-expected` the next time any test in this environment runs `make results`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Paired with pgxntool commit 93aa10f. The script's fail-closed claims were asserted in the PR body but only partly tested, and two of them weren't true: an empty `regression.diffs` and junk following a valid block both passed. Adds script-level coverage for an empty `regression.diffs`, a block with no hunks (also what a pre-12 context diff degrades to) and one with only some `@@ -0,0` hunks, unrecognized content after a valid block, and both of psql's real error renderings -- column 0 and the `psql:<file>:<line>:` prefix an \i'd file produces -- plus the passing test whose description merely mentions `ERROR:`, which used to be blocked. The end-to-end `make results` test now asserts the "no expected output yet" message, so it can't pass on a file that appeared some other way. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`\ No newline at end of file` is part of the diff format, so the new unrecognized-content check must not read it as junk -- doing so would block the first bless of any test whose output lacks a trailing newline. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diff body lines with no `diff ` header before them produce no classification rather than an unrecognized one, so they reach a separate guard from the junk case above it. Both have to block; only one was tested. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
| # Test: verify-results-pgtap.sh - pure script-logic unit tests | ||
| # | ||
| # These tests exercise pgxntool's verify-results-pgtap.sh directly against a | ||
| # bare scratch directory -- no foundation environment, no `make`, no |
There was a problem hiding this comment.
Except we're calling load_test_env; doesn't that in fact create a foundation environment?
There was a problem hiding this comment.
(To be clear, it would be nice to avoid foundation if that's reasonable, since it's faster.)
There was a problem hiding this comment.
[Claude] load_test_env here only calls create_env (makes test/.envs/<name>/.bats-state and a .env of path exports) and then setup_pgxntool_vars to resolve PGXNREPO. There is no git init, template copy, setup.sh, or PostgreSQL, so this file is already foundation-free (same pattern as check-stale-expected-script.bats). I ran the file and confirmed test/.envs/verify-results-pgtap-script/ contains only .bats-state and .env, with no repo dir (the foundation env does have one). Added a one-line comment at both load_test_env calls in dcea5dc. This also covers your follow-up (4179007811): nothing further to avoid.
…o foundation Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Test coverage for pgxntool PR Postgres-Extensions/pgxntool#121, which lets
make resultsseed the first expected output for a brand-new test (pgxntool issue #119).New
test/standard/verify-results-pgtap-script.batsownsverify-results-pgtap.sh's decision logic, invoking the script directly against a scratch directory with no Make, no foundation environment and no PostgreSQL — the layeringCLAUDE.mdprescribes, modeled oncheck-stale-expected-script.bats. It covers:@@ -0,0hunk) now passingregression.diffspg_regressfeeds psql on stdin) and thepsql:<file>:<line>:prefix an\i'd file produces — a column-anchored match would miss the second, which is whatsetup.sql/finish.sqlgenerateERROR:being blessed rather than permanently refusedregression.diffsblocking (pg_regressbailed before comparing anything;test/results/holds a stale run)@@ -0,0hunks\ No newline at end of filemarker still doesn'tdiff/@@headers, not by diffed content that looks like a header (both directions: a+@@ ...line inside added content, and a deleted-- commentrendering as--- comment)not ok/# TODO/ plan-mismatch scanmake-test.batskeeps only what genuinely needs a realpg_regressrun: an end-to-end test thatmake resultsseeds a brand-new test's first expected output — asserting theno expected output yetmessage, so it can't pass on a file that appeared some other way — and one wiring test thatmake verify-resultsinvokes the script and surfaces its failure. Its TODO and plan-mismatch cases moved into the script-level file rather than paying for a fullmake verify-resultsrun each to re-test logic decided entirely inside the script.Test plan
test/standard/verify-results-pgtap-script.bats: 16/16 pass.test-allagainst a local pgxntool with pgxntool PR #109 merged in: 273/273 pass, 0 failed, 0 skipped, including every test added or changed here.regression.diffsand junk-after-a-block fixtures exit 0 there (fail-open) and 1 now; theERROR:-in-a-description fixture exits 1 there (false positive) and 0 now.test-allagainst pgxntoolmasteras it stands today: 14 failures, 0 skipped. All 14 are pre-existing and unrelated to this PR, and CI reproduces exactly the same 14 — they are the tests merged in Cover test-build ordering, build-results, and test/install ON_ERROR_STOP #79 for pgxntool PR #109 (check-test-install-error-stop.sh,build-results,test-buildordering, the dist manifest entry for that script, andtest/installmarker state). That PR is still open, so the script and targets those tests exercise don't exist in pgxntoolmasteryet; the script-level ones fail with exit 127, "No such file or directory". CI here cannot go green until #109 lands, independently of this PR.