Re: Unit tests for SLRU
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Aleksander Alekseev <aleksander@timescale.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Pavel Borisov <pashkin.elfe@gmail.com>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>, Maxim Orlov <orlovmg@gmail.com>, Noah Misch <noah@leadboat.com>, Daniel Gustafsson <daniel@yesql.se>
Date: 2022-11-14T11:19:08Z
Lists: pgsql-hackers
Attachments
- v6-0001-Add-unit-tests-for-SLRU.patch (text/x-diff) patch v6-0001
On Fri, Nov 11, 2022 at 02:11:08PM +0900, Michael Paquier wrote: > Is there a reason why you need a TAP test here? It is by design more > expensive than pg_regress and it does not require --enable-tap-tests. > See for example what we do for snapshot_too_old, commit_ts, > worker_spi, etc., where each module uses a custom configuration file. I have put my hands on that, and I found that the tests were a bit overengineered. First, SimpleLruDoesPhysicalPageExist() is not that much necessary before and after each operation, like truncation or deletion, as the previous pages were doing equal tests. The hardcoded page number lacks a bit of flexibility and readability IMO, especially when combined with the number of pages per segments, as well. I have reworked that as per the attached, that provides basically the same coverage, going through a SQL interface for the whole thing. Like all the other tests of its kind, this does not use a TAP test, relying on a custom configuration file instead. This still needs some polishing, but the basics are here. What do you think? -- Michael
Commits
-
Add test module for SLRUs
- 006b69fd912b 16.0 landed
-
Fix comment of SimpleLruInit() in slru.c
- 9e0321135cae 14.7 landed
- 5962c8cbe5a6 15.2 landed
- 5ca3645cb3fb 16.0 landed