Skip to content

Conversation

@eeeebbbbrrrr
Copy link
Contributor

@eeeebbbbrrrr eeeebbbbrrrr commented May 9, 2025

This fixes a few issues with cargo pgrx regress that were found after its initial release.

  1. Pressing <ENTER> to "Accept[Y, n]?" a test no longer panics
  2. While we still git add <new expected/test_name.out> files, we no longer do it to the expected files that we promote in the face of a test failure
  3. Fix a bug where we'd think there's a test_name.out file to copy to expected/ when that's not actually true
  4. The setup.sql test is now treated as a normal test, and the only special handling around is that we'll only run it if we detect we need to
  5. Cleanup test run output to be consistent between Postgres versions
  6. Set PGRX_REGRESS_TESTING=1 so an extension running under the regression test suite can detect it

…** when it needs to, which is...

   - when the database is being (re)created
   - when its timestamp is different from an existing `setup.out`
   - when `setup.sql` exists but `setup.out` doesn't

- make sure the database is (re)created when `setup.sql` has changed

This allows its output to be automatically accepted on a test failure when `--auto` is used
@eeeebbbbrrrr eeeebbbbrrrr requested a review from Copilot May 9, 2025 13:39
Copy link

Copilot AI left a comment

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 implements fixes and improvements to the cargo pgrx regress process by addressing issues with test output promotion, setup file handling, and log formatting. Key changes include:

  • Introducing a new helper function to determine if setup.sql is newer than its expected output.
  • Refactoring test file listings and output processing functions to conditionally include the setup file.
  • Updating log output formatting and adjusting git-add behavior for output files.
Comments suppressed due to low confidence (1)

cargo-pgrx/src/command/regress.rs:265

  • [nitpick] Consider clarifying the naming and purpose of the 'include_setup' parameter, as its semantic linkage with 'created_db' might be unclear to future maintainers.
include_setup: bool,

…now if they're being run via a regression test
@eeeebbbbrrrr eeeebbbbrrrr merged commit 2cea87d into pgcentralfoundation:develop May 9, 2025
15 checks passed
eeeebbbbrrrr added a commit that referenced this pull request May 9, 2025
Welcome to pgrx v0.14.3.  

This point release fixes some issues discovered with the new `cargo pgrx
regress` command. Additionally, bindings have been regenerated against
the latest Postgres point releases that dropped on May 8th, 2025, though
no new headers have been included.


As always, please update with `cargo install cargo-pgrx --version 0.14.3
--locked` and update your extension `Cargo.toml` files with `cargo pgrx
upgrade`.

## What's Changed

* Fixes to `cargo pgrx regress` by @eeeebbbbrrrr in
#2062
   1) Pressing `<ENTER>` to "Accept[Y, n]?" a test no longer panics
2) While we still `git add <new expected/test_name.out>` files, we no
longer do it to the expected files that we promote in the face of a test
failure
3) Fix a bug where we'd think there's a `test_name.out` file to copy to
`expected/` when that's not actually true
4) The `setup.sql` test is now treated as a normal test, and the only
special handling around is that we'll only run it if we detect we need
to
   5) Cleanup test run output to be consistent between Postgres versions
6) Set `PGRX_REGRESS_TESTING=1` so an extension running under the
regression test suite can detect it


**Full Changelog**:
v0.14.2...v0.14.3
KenjiBrown pushed a commit to SoftwareLibreMx/pgrx that referenced this pull request May 27, 2025
This fixes a few issues with `cargo pgrx regress` that were found after
its initial release.

1) Pressing `<ENTER>` to "Accept[Y, n]?" a test no longer panics
2) While we still `git add <new expected/test_name.out>` files, we no
longer do it to the expected files that we promote in the face of a test
failure
3) Fix a bug where we'd think there's a `test_name.out` file to copy to
`expected/` when that's not actually true
4) The `setup.sql` test is now treated as a normal test, and the only
special handling around is that we'll only run it if we detect we need
to
5) Cleanup test run output to be consistent between Postgres versions
6) Set `PGRX_REGRESS_TESTING=1` so an extension running under the
regression test suite can detect it
KenjiBrown pushed a commit to SoftwareLibreMx/pgrx that referenced this pull request May 27, 2025
Welcome to pgrx v0.14.3.  

This point release fixes some issues discovered with the new `cargo pgrx
regress` command. Additionally, bindings have been regenerated against
the latest Postgres point releases that dropped on May 8th, 2025, though
no new headers have been included.


As always, please update with `cargo install cargo-pgrx --version 0.14.3
--locked` and update your extension `Cargo.toml` files with `cargo pgrx
upgrade`.

## What's Changed

* Fixes to `cargo pgrx regress` by @eeeebbbbrrrr in
pgcentralfoundation#2062
   1) Pressing `<ENTER>` to "Accept[Y, n]?" a test no longer panics
2) While we still `git add <new expected/test_name.out>` files, we no
longer do it to the expected files that we promote in the face of a test
failure
3) Fix a bug where we'd think there's a `test_name.out` file to copy to
`expected/` when that's not actually true
4) The `setup.sql` test is now treated as a normal test, and the only
special handling around is that we'll only run it if we detect we need
to
   5) Cleanup test run output to be consistent between Postgres versions
6) Set `PGRX_REGRESS_TESTING=1` so an extension running under the
regression test suite can detect it


**Full Changelog**:
pgcentralfoundation/pgrx@v0.14.2...v0.14.3
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.

1 participant