Re: TAP tests for pg_verify_checksums - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: TAP tests for pg_verify_checksums
Date
Msg-id 20181010015002.GA2204@paquier.xyz
Whole thread Raw
In response to Re: TAP tests for pg_verify_checksums  (Michael Banck <michael.banck@credativ.de>)
Responses Re: TAP tests for pg_verify_checksums  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
On Tue, Oct 09, 2018 at 05:14:50PM +0200, Michael Banck wrote:
> Am Dienstag, den 09.10.2018, 16:54 +0200 schrieb Peter Eisentraut:
>> On 06/10/2018 13:46, Michael Paquier wrote:
>
>>> +# Time to create a corruption
>
> That looks a bit weird, maybe "some corruption"? Or maybe it's just me
> not being a native speaker.

Okay, let's do with your suggestion.

>> I would also like to see a test that runs against a cluster without
>> checksums enabled.

OK.  I have added a test within initdb to save one initdb run.

>> +# Checks cannot happen for an online cluster
>> +$node->start;
>> +command_fails(['pg_verify_checksums',  '-D', $pgdata],
>> +                         "checksum checks not done");
>>
>> The test name should be something like "fails with online cluster".

Done.  I have put more thoughts into those.

> One more thing we could check is the relfilenode after we corrupted it,
> it should also catch the corruption then. Or is that too trivial?

There is one as of v3:
+# Checksum checks on single relfilenode fail
+$node->command_checks_all([ 'pg_verify_checksums', '-D', $pgdata, '-r',
+                           $relfilenode_corrupted],
+                         1,
+                         [qr/Bad checksums:.*1/],
+                         [qr/checksum verification failed/],
+                         '');

The resulting patch is attached.  Does that look good?
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: "Tsunakawa, Takayuki"
Date:
Subject: RE: IDE setup and development features?
Next
From: Michael Paquier
Date:
Subject: Re: out-of-order XID insertion in KnownAssignedXids