Refactor routine to find single log content pattern in TAP tests
Michael Paquier <michael@paquier.xyz>
Refactor routine to find single log content pattern in TAP tests The same routine to check if a specific pattern can be found in the server logs was copied over four different test scripts. This refactors the whole to use a single routine located in PostgreSQL::Test::Cluster, named log_contains, to grab the contents of the server logs and check for a specific pattern. On HEAD, the code previously used assumed that slurp_file() could not handle an undefined offset, setting it to zero, but slurp_file() does do an extra fseek() before retrieving the log contents only if an offset is defined. In two places, the test was retrieving the full log contents with slurp_file() after calling substr() to apply an offset, ignoring that slurp_file() would be able to handle that. Backpatch all the way down to ease the introduction of new tests that could rely on the new routine. Author: Vignesh C Reviewed-by: Andrew Dunstan, Dagfinn Ilmari Mannsåker, Michael Paquier Discussion: https://postgr.es/m/CALDaNm0YSiLpjCmajwLfidQrFOrLNKPQir7s__PeVvh9U3uoTQ@mail.gmail.com Backpatch-through: 11
Files
| Path | Change | +/− |
|---|---|---|
| src/test/authentication/t/003_peer.pl | modified | +3 −14 |
| src/test/perl/PostgreSQL/Test/Cluster.pm | modified | +16 −0 |
| src/test/recovery/t/019_replslot_limit.pl | modified | +8 −27 |
| src/test/recovery/t/033_replay_tsp_drops.pl | modified | +1 −12 |
| src/test/recovery/t/035_standby_logical_decoding.pl | modified | +4 −22 |
Discussion
- Implement generalized sub routine find_in_log for tap test 19 messages · 2023-05-25 → 2023-06-11