mirror of
https://github.com/postgres/postgres.git
synced 2025-06-07 11:02:12 +03:00
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
This commit is contained in:
parent
7bbc46213d
commit
f52345995d
@ -396,7 +396,7 @@ $oldnode->stop;
|
|||||||
# Cause a failure at the start of pg_upgrade, this should create the logging
|
# Cause a failure at the start of pg_upgrade, this should create the logging
|
||||||
# directory pg_upgrade_output.d but leave it around. Keep --check for an
|
# directory pg_upgrade_output.d but leave it around. Keep --check for an
|
||||||
# early exit.
|
# early exit.
|
||||||
command_fails(
|
command_checks_all(
|
||||||
[
|
[
|
||||||
'pg_upgrade', '--no-sync',
|
'pg_upgrade', '--no-sync',
|
||||||
'-d', $oldnode->data_dir,
|
'-d', $oldnode->data_dir,
|
||||||
@ -408,6 +408,9 @@ command_fails(
|
|||||||
'-P', $newnode->port,
|
'-P', $newnode->port,
|
||||||
$mode, '--check',
|
$mode, '--check',
|
||||||
],
|
],
|
||||||
|
1,
|
||||||
|
[qr{check for ".*?does/not/exist" failed}],
|
||||||
|
[],
|
||||||
'run of pg_upgrade --check for new instance with incorrect binary path');
|
'run of pg_upgrade --check for new instance with incorrect binary path');
|
||||||
ok(-d $newnode->data_dir . "/pg_upgrade_output.d",
|
ok(-d $newnode->data_dir . "/pg_upgrade_output.d",
|
||||||
"pg_upgrade_output.d/ not removed after pg_upgrade failure");
|
"pg_upgrade_output.d/ not removed after pg_upgrade failure");
|
||||||
|
@ -130,7 +130,7 @@ $old_sub->safe_psql('postgres',
|
|||||||
|
|
||||||
$old_sub->stop;
|
$old_sub->stop;
|
||||||
|
|
||||||
command_fails(
|
command_checks_all(
|
||||||
[
|
[
|
||||||
'pg_upgrade',
|
'pg_upgrade',
|
||||||
'--no-sync',
|
'--no-sync',
|
||||||
@ -144,6 +144,11 @@ command_fails(
|
|||||||
$mode,
|
$mode,
|
||||||
'--check',
|
'--check',
|
||||||
],
|
],
|
||||||
|
1,
|
||||||
|
[
|
||||||
|
qr/\QYour installation contains subscriptions without origin or having relations not in i (initialize) or r (ready) state\E/
|
||||||
|
],
|
||||||
|
[],
|
||||||
'run of pg_upgrade --check for old instance with relation in \'d\' datasync(invalid) state and missing replication origin'
|
'run of pg_upgrade --check for old instance with relation in \'d\' datasync(invalid) state and missing replication origin'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ command_like(
|
|||||||
'updated default char signedness is unsigned in control file');
|
'updated default char signedness is unsigned in control file');
|
||||||
|
|
||||||
# Cannot use --set-char-signedness option for upgrading from v18+
|
# Cannot use --set-char-signedness option for upgrading from v18+
|
||||||
command_fails(
|
command_checks_all(
|
||||||
[
|
[
|
||||||
'pg_upgrade', '--no-sync',
|
'pg_upgrade', '--no-sync',
|
||||||
'-d', $old->data_dir,
|
'-d', $old->data_dir,
|
||||||
@ -54,6 +54,9 @@ command_fails(
|
|||||||
'--set-char-signedness', 'signed',
|
'--set-char-signedness', 'signed',
|
||||||
$mode
|
$mode
|
||||||
],
|
],
|
||||||
|
1,
|
||||||
|
[qr/--set-char-signedness option cannot be used/],
|
||||||
|
[],
|
||||||
'--set-char-signedness option cannot be used for upgrading from v18 or later'
|
'--set-char-signedness option cannot be used for upgrading from v18 or later'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user