-
Notifications
You must be signed in to change notification settings - Fork 193
Regression Tests Guide
PostgreSQL regression tests are used to verify the correctness of features and catch regressions. These tests execute SQL scripts and compare the results with predefined .out files.
Each test should ensure isolation and repeatability using specific settings (see below).
Create your test file under the appropriate directory:
-
For
pg_documentdb:pg_documentdb/src/test/regress/sql/ -
For
pg_documentdb_core:pg_documentdb_core/src/test/regress/sql/
Each test file must begin with the following:
SET documentdb.next_collection_id TO <COLLECTION_ID>;
SET documentdb.next_collection_index_id TO <COLLECTION_INDEX_ID>;Important Constraints:
-
CollectionIdmust be a multiple of 100 and you can get the next available number by validate_test_output.sh -
CollectionIdandCollectionIndexIdmust match
This ensures test isolation and repeatable results.
Add the file name (without .sql) to the appropriate schedule file to include it in the make check run. For example:
-
pg_documentdb:
pg_documentdb/src/test/regress/basic_schedule
make check-minimal -C pg_documentdb EXTRA_TESTS=<test-name-without-extension>
# Example:
make check-minimal -C pg_documentdb EXTRA_TESTS=commands_deleteIf it's a new test, you'll get a failure because there’s no expected .out file yet. One will be auto-created (and empty) in:
pg_documentdb/src/test/regress/expected/
If the output of your test looks as expected, copy the contents into the expected .out file.
cp pg_documentdb/src/test/regress/results/<your_test>.out pg_documentdb/src/test/regress/expected/<your_test>.outmake checkTo avoid ID collisions and find the next available collection ID, run:
pg_documentdb/src/test/regress/validate_test_output.sh <pg_version>