Re: Improved TAP tests by replacing sub-optimal uses of ok() with better Test::More functions

From: Sadhuprasad Patro <b(dot)sadhu(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Improved TAP tests by replacing sub-optimal uses of ok() with better Test::More functions
Date: 2025-10-30 11:30:27
Message-ID: CAFF0-CEUy6MC96oQbOvtmixrMmBoFSY5O26d5wjL5BpXpe1CZg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thank you Michael for committing the patch...

On Fri, Oct 17, 2025 at 11:11 AM Michael Paquier <michael(at)paquier(dot)xyz>
wrote:

> On Thu, Oct 16, 2025 at 04:26:48PM +0900, Michael Paquier wrote:
> > -ok($node_s->safe_psql($db1, "SELECT COUNT(*) = 2 FROM pg_publication"),
> > - 'two pre-existing publications on subscriber');
> > +is($node_s->safe_psql($db1, "SELECT COUNT(*) = 2 FROM pg_publication"),
> > + 't',
> > + 'two pre-existing publications on subscriber');
>
> Note here: we can just compare the result with '2'.
>
> > -ok($node_replica->safe_psql('postgres', $canary_query) == 0,
> > - 'canary is missing');
> > +is($node_replica->safe_psql('postgres', $canary_query), 0,
> > + 'canary is missing');
> > [...]
> > -ok($node_replica->safe_psql('postgres', $canary_query) == 1,
> > +is($node_replica->safe_psql('postgres', $canary_query), 1,
> > 'canary is present');
>
> Fixed and backpatched these two at the end as they could mask bugs, on
> the branches where they matter.
>
> Not sure that the bits in 010_pg_basebackup were an improvement. In
> 004_test_parser_perf, the result is indeed empty, but it's a matter of
> the result returned by IPC::run::run.
>
> -ok($node->log_contains(qr/no SSL error reported/) == 0,
> +is($node->log_contains(qr/no SSL error reported/), 0
>
> The CI was failing with the change in the SSL tests, as of:
> [05:03:12.647] # at
> /tmp/cirrus-ci-build/src/test/ssl/t/001_ssltests.pl line 127.
> [05:03:12.647] # got: ''
> [05:03:12.647] # expected: '0'
>
> There was already a lot of content already. So I have left this one
> out for the moment and applied a good chunk of the rest with some
> indentation.
> --
> Michael
>

--
thank u
SADHU PRASAD

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mircea Cadariu 2025-10-30 11:46:00 Re: [BUG] temporary file usage report with extended protocol and unnamed portals
Previous Message Chao Li 2025-10-30 11:15:34 Re: Improve pg_sync_replication_slots() to wait for primary to advance