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
The 'cargo pgrx new' command was creating pg_regress directories at
the project root (./pg_regress/), while 'cargo pgrx regress' expected
them under the tests directory (./tests/pg_regress/). This
inconsistency caused immediate failures when running regression tests
on newly created projects.
Fix the path mismatch by updating 'cargo pgrx new' to create the
pg_regress directory structure under tests/, aligning with where
'cargo pgrx regress' expects to find them. This follows Rust's
convention of organizing test files in a tests/ directory.
Also update the documentation and the hooks example to use the
consistent path structure.
Fixes: #2136 ("Inconsistencies in the pg_regress path")
Signed-off-by: Charalampos Mitrodimas <[email protected]>
Copy file name to clipboardExpand all lines: cargo-pgrx/README.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -590,12 +590,12 @@ $ tree
590
590
591
591
`setup.sql` is a special test in that it's run first, by itself, whenever the test database is first created, or reset using the `--resetdb` argument.
592
592
593
-
When creating a new test, first make the `.sql` file in `./pg_regress/sql/` and then run `cargo pgrx regress`. pgrx will detect that the file is new and interactively prompt you to add its output, automatically adding it to git (if the directory is managed by git).
593
+
When creating a new test, first make the `.sql` file in `./tests/pg_regress/sql/` and then run `cargo pgrx regress`. pgrx will detect that the file is new and interactively prompt you to add its output, automatically adding it to git (if the directory is managed by git).
Using DefaultFeature("pg13") and `pg_config` from ~/.pgrx/13.20/pgrx-install/bin/pg_config
601
601
Stopping Postgres v13
@@ -627,7 +627,7 @@ test `example` generated the above output:
627
627
Accept [Y, n]?
628
628
```
629
629
630
-
Typing `Y` (or just pressing return) will copy the test output to the proper location, `./pg_regress/expected/example.sql` and then run the entire test suite:
630
+
Typing `Y` (or just pressing return) will copy the test output to the proper location, `./tests/pg_regress/expected/example.out` and then run the entire test suite:
631
631
632
632
```console
633
633
...
@@ -657,7 +657,7 @@ Alternatively, you can run `cargo pgrx regress --auto` (or `-a`) to **automatica
657
657
- tests are executed in alphabetical order
658
658
- pgrx creates a database named `$extname_regress` unless `--dbname` is used
659
659
- Postgres' documentation for `pg_regress`[begins here](https://www.postgresql.org/docs/current/regress.html). While pgrx does not support every knob and dial, its organization is largely compatible (PRs welcome to enhance features)
660
-
- to regenerate the expected test output, delete the `./pg_regress/expected/TEST_NAME.out` file and run `cargo pgrx regress`. You'll be prompted to accept the new output and it'll automatically be run through `git add`
660
+
- to regenerate the expected test output, delete the `./tests/pg_regress/expected/TEST_NAME.out` file and run `cargo pgrx regress`. You'll be prompted to accept the new output and it'll automatically be run through `git add`
661
661
-`pg_regress` uses `psql` to run each test and literally diffs the output against the expected output file. pgrx does two things to help eliminate noise in the test output. The first is it sets `client_min_messages=warning` when starting the Postgres instance and it also passes `-v VERBOSITY=terse` through to `psql`.
0 commit comments