Skip to content

Commit f523459

Browse files
pg_upgrade: Check for the expected error message in TAP tests.
Since pg_upgrade prints its error messages on stdout, we can't use command_fails_like() to check if it fails for the right reason. This commit uses command_checks_all() in pg_upgrade TAP tests to check the exit status and stdout, enabling proper verification of error reasons. Author: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> Discussion: https://postgr.es/m/87tt8h1vb7.fsf@wibble.ilmari.org
1 parent 7bbc462 commit f523459

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

src/bin/pg_upgrade/t/002_pg_upgrade.pl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ sub filter_dump
396396
# Cause a failure at the start of pg_upgrade, this should create the logging
397397
# directory pg_upgrade_output.d but leave it around. Keep --check for an
398398
# early exit.
399-
command_fails(
399+
command_checks_all(
400400
[
401401
'pg_upgrade', '--no-sync',
402402
'-d', $oldnode->data_dir,
@@ -408,6 +408,9 @@ sub filter_dump
408408
'-P', $newnode->port,
409409
$mode, '--check',
410410
],
411+
1,
412+
[qr{check for ".*?does/not/exist" failed}],
413+
[],
411414
'run of pg_upgrade --check for new instance with incorrect binary path');
412415
ok(-d $newnode->data_dir . "/pg_upgrade_output.d",
413416
"pg_upgrade_output.d/ not removed after pg_upgrade failure");

src/bin/pg_upgrade/t/004_subscription.pl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130

131131
$old_sub->stop;
132132

133-
command_fails(
133+
command_checks_all(
134134
[
135135
'pg_upgrade',
136136
'--no-sync',
@@ -144,6 +144,11 @@
144144
$mode,
145145
'--check',
146146
],
147+
1,
148+
[
149+
qr/\QYour installation contains subscriptions without origin or having relations not in i (initialize) or r (ready) state\E/
150+
],
151+
[],
147152
'run of pg_upgrade --check for old instance with relation in \'d\' datasync(invalid) state and missing replication origin'
148153
);
149154

src/bin/pg_upgrade/t/005_char_signedness.pl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
'updated default char signedness is unsigned in control file');
4242

4343
# Cannot use --set-char-signedness option for upgrading from v18+
44-
command_fails(
44+
command_checks_all(
4545
[
4646
'pg_upgrade', '--no-sync',
4747
'-d', $old->data_dir,
@@ -54,6 +54,9 @@
5454
'--set-char-signedness', 'signed',
5555
$mode
5656
],
57+
1,
58+
[qr/--set-char-signedness option cannot be used/],
59+
[],
5760
'--set-char-signedness option cannot be used for upgrading from v18 or later'
5861
);
5962

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy