Re: pg_createsubscriber TAP test wrapping makes command options hard to read.

From: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Peter Smith <smithpb2250(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_createsubscriber TAP test wrapping makes command options hard to read.
Date: 2025-01-22 15:34:11
Message-ID: 87bjvy50cs.fsf@wibble.ilmari.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Michael,

Thanks for committing!

Michael Paquier <michael(at)paquier(dot)xyz> writes:

> On Tue, Jan 21, 2025 at 02:17:03PM +0000, Dagfinn Ilmari Mannsåker wrote:
>> Thanks again for reviewing this monster patch.
>
> +$node->command_checks_all(
> + [ 'pg_amcheck', '--exclude-user' => 'no_such_user', 'postgres' ],
>
> Extra error spotted here with s/--exclude-user/--username/.

I've attached a patch to make it check that it's actually complaining
about the role not existing, not an unrecognised option.

> The double --verbose for test 'run pg_createsubscriber on node S' is
> intentional, as mentioned by Euler. Fixed this one by making the two
> --verbose be side-by-side, and added a comment to document the
> intention.

Good call.

> Perhaps pg_resetwal/t/001_basic.pl should also use more long option
> names? Note that there are a few more under "Locale provider
> tests" in the initdb tests. I've left that as a follow-up thing,
> that was already a lot..

As I mentioned elsewhere in the thread, I left those alone since the
error message uses the short spelling even if the command had the long
one. We could add the long spelling to the preceding comments, like the
second attached patch.

> Found some more inconsistencies with the ordering of the options, like
> a few start commands with pg_ctl in the recovery tests. I've
> maintained some consistency here, even if your patch was OK.

Most invocations of pg_ctl actually have the action before any options:

❯ rg --multiline -tperl '(\W)pg_ctl\1,\s*(\W)\w+\2' | rg -cw pg_ctl
23

❯ rg --multiline -tperl '(\W)pg_ctl\1,\s*(\W)--\w+\2' | rg -cw pg_ctl
11

I've attached a third patch to make them consistently have the action
first.

- ilmari

Attachment Content-Type Size
0001-Check-that-pg_amcheck-with-a-bad-username-actually-c.patch text/x-diff 1.0 KB
0002-pg_resetwal-TAP-test-more-long-options.patch text/x-diff 3.3 KB
0003-TAP-tests-consistently-specify-the-pg_ctl-action-bef.patch text/x-diff 4.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-01-22 15:34:16 Re: [PATCH] Fix a tiny typo in the documentation
Previous Message Nathan Bossart 2025-01-22 15:27:13 Re: [PATCH] SVE popcount support