| From: | Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com> |
|---|---|
| To: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: New test function replace_conf() to get rid of unlink/append pattern |
| Date: | 2026-10-12 19:15:07 |
| Message-ID: | CAJTYsWVyicarPOi8vuz-ZvyLPbhcam1apn+wVBw+H4EvNkJWbQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
On Mon, 12 Oct 2026 at 14:49, Daniel Gustafsson <daniel(at)yesql(dot)se> wrote:
>
> We have a fairly common pattern in the TAP tests where we first unlink() a
> config file and then do append_conf() on it in order to rewrite it from
> scratch. There's nothing wrong with it but it's IMO not as readable as it can
> be (especially when unlink and append_conf are vertically separated), and
> slightly errorprone as the unlink requires one to assemble the path whereas
> append_conf does that automatically (yes, I have done that exact mistake during
> hacking).
>
> To make the TAP tests more readable I propose a utility function which combines
> these two operations, replace_conf(). It works just like how unlink() together
> with append_conf() does but in fewer and more readable lines of code. I chose
> replace rather than rewrite since it IMO more clearly signals that nothing in
> the file is kept.
Thanks for the patch! It makes sense to me to have this function, makes
the tests easier to follow.
Small nit on the replace vs rewrite thing you mentioned: should we change
the below comment too to use "replacing"?
-A shortcut method for rewriting a configuration file.
+A shortcut method for replacing a configuration file.
Also, I noticed the forked-backend SKIP block in
src/test/ssl/t/004_sni.pl still skips 11 tests. Since we're removing the
ok(unlink(...)) assertion, ig that should be 10 now.
Regards,
Ayush
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Greg Burd | 2026-10-12 19:19:03 | Re: Tepid: selective index updates for heap relations |
| Previous Message | Alexandre Felipe | 2026-10-12 18:40:47 | Re: Restructured Shared Buffer Hash Table |