use PostgresNode;
use TestLib;
-use Test::More tests => 60;
+use Test::More tests => 63;
my ($node, $port, %corrupt_page, %remove_relation);
# Test set-up
$node = get_new_node('test');
$node->init;
+$node->append_conf('postgresql.conf', 'autovacuum=off');
$node->start;
$port = $node->port;
# Leave 'db3' uncorrupted
#
-# Perform the corruptions we planned above using only a single database restart.
-#
-perform_all_corruptions();
-
-
# Standard first arguments to TestLib functions
my @cmd = ('pg_amcheck', '--quiet', '-p', $port);
my $missing_file_re = qr/could not open file ".*": No such file or directory/;
my $index_missing_relation_fork_re = qr/index ".*" lacks a main relation fork/;
+# We have created test databases with tables populated with data, but have not
+# yet corrupted anything. As such, we expect no corruption and verify that
+# none is reported
+#
+$node->command_checks_all(
+ [ @cmd, '-d', 'db1', '-d', 'db2', '-d', 'db3' ],
+ 0,
+ [ $no_output_re ],
+ [ $no_output_re ],
+ 'pg_amcheck prior to corruption');
+
+# Perform the corruptions we planned above using only a single database restart.
+#
+perform_all_corruptions();
+
+
# Checking databases with amcheck installed and corrupt relations, pg_amcheck
# command itself should return exit status = 2, because tables and indexes are
# corrupt, not exit status = 1, which would mean the pg_amcheck command itself