|
3 | 3 |
|
4 | 4 | use PostgresNode;
|
5 | 5 | use TestLib;
|
6 |
| -use Test::More tests => 60; |
| 6 | +use Test::More tests => 63; |
7 | 7 |
|
8 | 8 | my ($node, $port, %corrupt_page, %remove_relation);
|
9 | 9 |
|
|
117 | 117 | # Test set-up
|
118 | 118 | $node = get_new_node('test');
|
119 | 119 | $node->init;
|
| 120 | +$node->append_conf('postgresql.conf', 'autovacuum=off'); |
120 | 121 | $node->start;
|
121 | 122 | $port = $node->port;
|
122 | 123 |
|
|
308 | 309 | # Leave 'db3' uncorrupted
|
309 | 310 | #
|
310 | 311 |
|
311 |
| -# Perform the corruptions we planned above using only a single database restart. |
312 |
| -# |
313 |
| -perform_all_corruptions(); |
314 |
| - |
315 |
| - |
316 | 312 | # Standard first arguments to TestLib functions
|
317 | 313 | my @cmd = ('pg_amcheck', '--quiet', '-p', $port);
|
318 | 314 |
|
|
322 | 318 | my $missing_file_re = qr/could not open file ".*": No such file or directory/;
|
323 | 319 | my $index_missing_relation_fork_re = qr/index ".*" lacks a main relation fork/;
|
324 | 320 |
|
| 321 | +# We have created test databases with tables populated with data, but have not |
| 322 | +# yet corrupted anything. As such, we expect no corruption and verify that |
| 323 | +# none is reported |
| 324 | +# |
| 325 | +$node->command_checks_all( |
| 326 | + [ @cmd, '-d', 'db1', '-d', 'db2', '-d', 'db3' ], |
| 327 | + 0, |
| 328 | + [ $no_output_re ], |
| 329 | + [ $no_output_re ], |
| 330 | + 'pg_amcheck prior to corruption'); |
| 331 | + |
| 332 | +# Perform the corruptions we planned above using only a single database restart. |
| 333 | +# |
| 334 | +perform_all_corruptions(); |
| 335 | + |
| 336 | + |
325 | 337 | # Checking databases with amcheck installed and corrupt relations, pg_amcheck
|
326 | 338 | # command itself should return exit status = 2, because tables and indexes are
|
327 | 339 | # corrupt, not exit status = 1, which would mean the pg_amcheck command itself
|
|
0 commit comments