pgsql: Provide test coverage in pg_dump for default behaviors with comp

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Provide test coverage in pg_dump for default behaviors with comp
Date: 2022-12-06 00:20:46
Message-ID: E1p2LhV-002AGC-8f@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Provide test coverage in pg_dump for default behaviors with compression

By default, the contents generated by the custom and directory dump
formats are compressed. However, with the existing test facility, the
restore program will succeed regardless of whether the dumped output was
compressed or not without checking if anything has been compressed.

This commit implements a portable way to check the contents of the
custom and directory dump formats:
- glob_patterns, that can be defined for each test as an array of
glob()-compilable strings, tracking the contents that should or should
not be compressed. While this is useful to make sure that the table
data is compressed, this also checks that blobs.toc and toc.dat are
never compressed.
- command_like, to execute a command on a dump and check its generated
output. This is used here in correlation with pg_restore -l to check if
the dumps have been compressed or not, depending on if the build
supports gzip, or not.

This hole in the tests has come up when working on 5e73a60, where
compression has to be applied by default, if available, for both dump
formats.

The idea of glob_patterns comes from me, and Georgios has come up with
the design for command_like.

Author: Georgios Kokolatos, Michael Paquier
Discussion: https://postgr.es/m/DQn4czCWR1rcbGPLL7p3LfEr5-kGmlySm-H05VgroINdikvhtS5r9EdI6b8D8sjnbKdJ09k-cxs2AqijBeHAWk9Q8gvEAxPRHuLRhwONcGc=@pm.me

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a7885c9bb22de3efcc0ba4e79bbde8a77e8b7036

Modified Files
--------------
src/bin/pg_dump/t/002_pg_dump.pl | 77 ++++++++++++++++++++++++++++++++++++----
1 file changed, 71 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alexander Korotkov 2022-12-06 00:29:33 pgsql: Check the snapshot argument of index_beginscan and family
Previous Message Peter Eisentraut 2022-12-05 22:40:17 pgsql: initdb: Refactor PG_CMD_PUTS loops