You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pgTAP-aware results validator, tolerant of suffixed/prefixed role names in assertion descriptions #106
A pgTAP-aware results validator would let projects run pgTAP against environments where object names vary per run.
Some CI setups run against a single shared database server, so concurrent builds give test-harness role names a per-build prefix or suffix. That changes pgTAP assertion description text (it embeds the role name), so the committed, unsuffixed test/expected/*.out can never byte-match via ordinary pg_regress/verify-results diffing, even when every assertion passes.
Rather than every extension writing its own script to scan test/results/*.out for "not ok" lines, plan-line presence and plan mismatches while ignoring description-text diffs, pgxntool could offer a pgTAP-aware validator as an alternative to base pg_regress diffing: one that understands pgTAP's TAP output (plan lines, ok/not ok, TODO/SKIP directives) well enough to verify correctness independent of description text.
Any extension using pgTAP against a test environment without fixed identities (per-build suffixed role or object names, or similar) would benefit.
Related gaps in the current pass/fail checks
These matter independently of the suffix case, and a validator should cover them.
make test fails only on regression.diffs. The pgTAP scan (verify-results-pgtap.sh) runs only as part of make results, before blessing. A not ok line that has already been blessed into an expected file still passes make test, since the actual output matches it byte for byte.
No plan-line check. The pgTAP verifier looks for not ok lines and for "Looks like you planned" messages, but does not require a 1..N plan line. A failure that stops the run before any not ok line is printed can therefore pass undetected.
test/install/*.sql content cannot fail make test. Output from test/install is never compared against anything, because actual and expected resolve to the same file. Only a hard SQL error with ON_ERROR_STOP set (which pgxntool statically checks for) makes the build fail; a not ok result or any other output difference in those files cannot. A validator should scan those results too.
Not scoped yet. Happy to discuss what the validator's pass/fail contract should look like.
Suggestion: run the test command through a small wrapper that fails on either a non-zero exit status or a failure-looking line in the output. make test alone is not enough, because the pgxntool test target only fails on a non-empty regression.diffs and does not scan pgTAP output.
The wrapper takes any command (not only make test), captures its combined stdout and stderr, and fails the overall run in two cases:
The command exits non-zero. The wrapper passes the command's own status through unchanged; it does not replace it with 1 or any other value, and no one should force the exit code to 1.
The captured output contains a line matching a failure pattern: not ok, FAILED, Looks like you planned, an N of M tests failed style summary, or the database error current transaction is aborted.
Both checks are needed. The exit code catches hard failures. The output scan catches TAP-style failures that a command can still exit 0 on.
Sketch:
# bash; usage: run-and-scan <command> [args...]
out=$(mktemp)"$@"2>&1| tee "$out"
status=${PIPESTATUS[0]}if grep -E -q 'not ok|FAILED|Looks like you planned|[0-9]+ of [0-9]+ tests? failed|current transaction is aborted'"$out";thenecho"failure pattern found in output">&2
[ "$status"-ne 0 ] || status=1 # only when the command itself exited 0fi
rm -f "$out"exit"$status"
Update on the motivating case for this issue: we no longer need output that varies per run.
The case was role names that get a per-build prefix or suffix and show up in pgTAP test descriptions. We removed it by replacing the real names in descriptions with fixed placeholders, so the expected output is byte-identical on every run. A content-tolerant validator is not needed for that case, and we have decided against using one as a general mechanism because it would also hide real changes in diagnostic text.
What still seems worth pgxntool's attention from this issue, and does not depend on the naming case:
A not ok line that gets accepted into an expected file still passes plain make test. Scanning the raw output for failure markers (not ok, FAILED, current transaction is aborted, and similar) catches this. We do that in a wrapper outside pgxntool.
Nothing requires a 1..N plan line in the result file. A test that dies before planning can look like a pass.
Activity
jnasbyupgrade commentedon Oct 12, 2026
🤖 (Claude)
Suggestion: run the test command through a small wrapper that fails on either a non-zero exit status or a failure-looking line in the output.
make testalone is not enough, because the pgxntool test target only fails on a non-emptyregression.diffsand does not scan pgTAP output.The wrapper takes any command (not only
make test), captures its combined stdout and stderr, and fails the overall run in two cases:not ok,FAILED,Looks like you planned, anN of M tests failedstyle summary, or the database errorcurrent transaction is aborted.Both checks are needed. The exit code catches hard failures. The output scan catches TAP-style failures that a command can still exit 0 on.
Sketch:
Add `PGXNTOOL_VERIFY_RESULTS_MODE=pgtap-only`
Test `PGXNTOOL_VERIFY_RESULTS_MODE=pgtap-only`
Remove `PGXNTOOL_ENABLE_CHECK_TAP_OUTPUT`
Follow the removal of `PGXNTOOL_ENABLE_CHECK_TAP_OUTPUT`
jnasbyupgrade commentedon Oct 15, 2026
🤖 (Claude)
Update on the motivating case for this issue: we no longer need output that varies per run.
The case was role names that get a per-build prefix or suffix and show up in pgTAP test descriptions. We removed it by replacing the real names in descriptions with fixed placeholders, so the expected output is byte-identical on every run. A content-tolerant validator is not needed for that case, and we have decided against using one as a general mechanism because it would also hide real changes in diagnostic text.
What still seems worth pgxntool's attention from this issue, and does not depend on the naming case:
not okline that gets accepted into an expected file still passes plainmake test. Scanning the raw output for failure markers (not ok,FAILED,current transaction is aborted, and similar) catches this. We do that in a wrapper outside pgxntool.1..Nplan line in the result file. A test that dies before planning can look like a pass.Refer to the pgxntool issue by its full name in make-test.bats