diff options
author | Michael Paquier | 2018-11-20 01:20:52 +0000 |
---|---|---|
committer | Michael Paquier | 2018-11-20 01:20:52 +0000 |
commit | 9685d7383ab48ebe6a6213530f64e4dc67776583 (patch) | |
tree | 39df69933ebf7f70111ed30bc32e0e06aaeb46b2 /src | |
parent | cb09903fe63132a35e4b217bc394882b05c0c6f3 (diff) |
Fix issues with TAP tests of pg_verify_checksums
Two issues have been spotted and get fixed here:
- When checking for corrupted files, make sure that pg_verify_checksums
complains about the correct file. In order to make the logic more
robust, all files created are immediately removed once checks on them
are done. The error message generated by pg_verify_checksums also now
includes the file name it sees as corrupted.
- Before running corruption-related tests, empty files are generated
which used names mapping with the corrupted files, potentially leading
to conflicts. So use different set of names for both.
Author: Michael Banck
Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/pg_verify_checksums/t/002_actions.pl | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/bin/pg_verify_checksums/t/002_actions.pl b/src/bin/pg_verify_checksums/t/002_actions.pl index d59970b7350..0e1725d9f2f 100644 --- a/src/bin/pg_verify_checksums/t/002_actions.pl +++ b/src/bin/pg_verify_checksums/t/002_actions.pl @@ -104,24 +104,28 @@ sub fail_corrupt my $pgdata = $node->data_dir; # Create the file with some dummy data in it. - append_to_file "$pgdata/global/$file", "foo"; + my $file_name = "$pgdata/global/$file"; + append_to_file $file_name, "foo"; $node->command_checks_all([ 'pg_verify_checksums', '-D', $pgdata], 1, [qr/^$/], - [qr/could not read block/], + [qr/could not read block 0 in file.*$file\":/], "fails for corrupted data in $file"); + # Remove file to prevent future lookup errors on conflicts. + unlink $file_name; return; } # Authorized relation files filled with corrupted data cause the -# checksum checks to fail. -fail_corrupt($node, "99999"); -fail_corrupt($node, "99999.123"); -fail_corrupt($node, "99999_fsm"); -fail_corrupt($node, "99999_init"); -fail_corrupt($node, "99999_vm"); -fail_corrupt($node, "99999_init.123"); -fail_corrupt($node, "99999_fsm.123"); -fail_corrupt($node, "99999_vm.123"); +# checksum checks to fail. Make sure to use file names different +# than the previous ones. +fail_corrupt($node, "99990"); +fail_corrupt($node, "99990.123"); +fail_corrupt($node, "99990_fsm"); +fail_corrupt($node, "99990_init"); +fail_corrupt($node, "99990_vm"); +fail_corrupt($node, "99990_init.123"); +fail_corrupt($node, "99990_fsm.123"); +fail_corrupt($node, "99990_vm.123"); |