summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorAlvaro Herrera2022-10-24 10:02:33 +0000
committerAlvaro Herrera2022-10-24 10:02:33 +0000
commit8328a15f8f95cad3fa99bbab551cade0a8403708 (patch)
tree7531f49daae15113eb06ac8fe6c183edaf901db0 /src/test
parent2e0d80c5bb722fb49a4cdc44b0c715ec77c83f79 (diff)
Fix recently added incorrect assertion
Commit df3737a651f4 added an incorrect assertion about the preconditions for invoking the backup cleanup callback: it misfires at session end in case a backup completes successfully. Fix it, using coding from Michaƫl Paquier. Also add some tests for the various cases. Reported by Kyotaro Horiguchi <horikyota.ntt@gmail.com> Discussion: https://postgr.es/m/20221021.161038.1277961198945653224.horikyota.ntt@gmail.com
Diffstat (limited to 'src/test')
-rw-r--r--src/test/recovery/t/020_archive_status.pl14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/recovery/t/020_archive_status.pl b/src/test/recovery/t/020_archive_status.pl
index 2108d50073a..fe9ac06b32d 100644
--- a/src/test/recovery/t/020_archive_status.pl
+++ b/src/test/recovery/t/020_archive_status.pl
@@ -248,4 +248,18 @@ my $logfile = slurp_file($standby2->logfile, $log_location);
ok( $logfile =~ qr/archiver process shutting down/,
'check shutdown callback of shell archive module');
+# Test that we can enter and leave backup mode without crashes
+my ($stderr, $cmdret);
+$cmdret = $primary->psql(
+ 'postgres',
+ "SELECT pg_backup_start('onebackup'); "
+ . "SELECT pg_backup_stop();"
+ . "SELECT pg_backup_start(repeat('x', 1026))",
+ stderr => \$stderr);
+is($cmdret, 3, "psql fails correctly");
+like($stderr, qr/backup label too long/, "pg_backup_start fails gracefully");
+$primary->safe_psql('postgres',
+ "SELECT pg_backup_start('onebackup'); SELECT pg_backup_stop();");
+$primary->safe_psql('postgres', "SELECT pg_backup_start('twobackup')");
+
done_testing();