pg_upgrade: Make testing different transfer modes easier
The environment variable PG_TEST_PG_UPGRADE_MODE can be set to override the default transfer mode for the pg_upgrade tests. (Automatically running the pg_upgrade tests for all supported modes would be too slow.) Reviewed-by: Daniel Gustafsson <daniel@yesql.se> Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/50a97009-8ff9-ca4d-a0f6-6086a6775a5b%40enterprisedb.com
This commit is contained in:
parent
746915c686
commit
b059a2409f
@ -3,6 +3,7 @@ THE SHORT VERSION
|
|||||||
|
|
||||||
On non-Windows machines, you can execute the testing process
|
On non-Windows machines, you can execute the testing process
|
||||||
described below by running the following command in this directory:
|
described below by running the following command in this directory:
|
||||||
|
|
||||||
make check
|
make check
|
||||||
|
|
||||||
This will run the TAP tests to run pg_upgrade, performing an upgrade
|
This will run the TAP tests to run pg_upgrade, performing an upgrade
|
||||||
@ -17,8 +18,18 @@ export olddump=...somewhere/dump.sql (old version's dump)
|
|||||||
export oldinstall=...otherversion/ (old version's install base path)
|
export oldinstall=...otherversion/ (old version's install base path)
|
||||||
|
|
||||||
Finally, the tests can be done by running
|
Finally, the tests can be done by running
|
||||||
|
|
||||||
make check
|
make check
|
||||||
|
|
||||||
|
You can also test the different transfer modes (--copy, --link,
|
||||||
|
--clone) by setting the environment variable PG_TEST_PG_UPGRADE_MODE
|
||||||
|
to the respective command-line option, like
|
||||||
|
|
||||||
|
make check PG_TEST_PG_UPGRADE_MODE=--link
|
||||||
|
|
||||||
|
The default is --copy. Note that the other modes are not supported on
|
||||||
|
all operating systems.
|
||||||
|
|
||||||
DETAILS
|
DETAILS
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
@ -12,6 +12,9 @@ use PostgreSQL::Test::Cluster;
|
|||||||
use PostgreSQL::Test::Utils;
|
use PostgreSQL::Test::Utils;
|
||||||
use Test::More;
|
use Test::More;
|
||||||
|
|
||||||
|
# Can be changed to test the other modes.
|
||||||
|
my $mode = $ENV{PG_TEST_PG_UPGRADE_MODE} || '--copy';
|
||||||
|
|
||||||
# Generate a database with a name made of a range of ASCII characters.
|
# Generate a database with a name made of a range of ASCII characters.
|
||||||
sub generate_db
|
sub generate_db
|
||||||
{
|
{
|
||||||
@ -75,6 +78,8 @@ my $tempdir = PostgreSQL::Test::Utils::tempdir;
|
|||||||
my $dump1_file = "$tempdir/dump1.sql";
|
my $dump1_file = "$tempdir/dump1.sql";
|
||||||
my $dump2_file = "$tempdir/dump2.sql";
|
my $dump2_file = "$tempdir/dump2.sql";
|
||||||
|
|
||||||
|
note "testing using transfer mode $mode";
|
||||||
|
|
||||||
# Initialize node to upgrade
|
# Initialize node to upgrade
|
||||||
my $oldnode =
|
my $oldnode =
|
||||||
PostgreSQL::Test::Cluster->new('old_node',
|
PostgreSQL::Test::Cluster->new('old_node',
|
||||||
@ -128,6 +133,7 @@ else
|
|||||||
# --inputdir points to the path of the input files.
|
# --inputdir points to the path of the input files.
|
||||||
my $inputdir = "$srcdir/src/test/regress";
|
my $inputdir = "$srcdir/src/test/regress";
|
||||||
|
|
||||||
|
note 'running regression tests in old instance';
|
||||||
my $rc =
|
my $rc =
|
||||||
system($ENV{PG_REGRESS}
|
system($ENV{PG_REGRESS}
|
||||||
. " $extra_opts "
|
. " $extra_opts "
|
||||||
@ -256,7 +262,8 @@ command_fails(
|
|||||||
'-s', $newnode->host,
|
'-s', $newnode->host,
|
||||||
'-p', $oldnode->port,
|
'-p', $oldnode->port,
|
||||||
'-P', $newnode->port,
|
'-P', $newnode->port,
|
||||||
'--check'
|
$mode,
|
||||||
|
'--check',
|
||||||
],
|
],
|
||||||
'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",
|
||||||
@ -270,7 +277,8 @@ command_ok(
|
|||||||
'-D', $newnode->data_dir, '-b', $oldbindir,
|
'-D', $newnode->data_dir, '-b', $oldbindir,
|
||||||
'-B', $newbindir, '-s', $newnode->host,
|
'-B', $newbindir, '-s', $newnode->host,
|
||||||
'-p', $oldnode->port, '-P', $newnode->port,
|
'-p', $oldnode->port, '-P', $newnode->port,
|
||||||
'--check'
|
$mode,
|
||||||
|
'--check',
|
||||||
],
|
],
|
||||||
'run of pg_upgrade --check for new instance');
|
'run of pg_upgrade --check for new instance');
|
||||||
ok(!-d $newnode->data_dir . "/pg_upgrade_output.d",
|
ok(!-d $newnode->data_dir . "/pg_upgrade_output.d",
|
||||||
@ -282,7 +290,8 @@ command_ok(
|
|||||||
'pg_upgrade', '--no-sync', '-d', $oldnode->data_dir,
|
'pg_upgrade', '--no-sync', '-d', $oldnode->data_dir,
|
||||||
'-D', $newnode->data_dir, '-b', $oldbindir,
|
'-D', $newnode->data_dir, '-b', $oldbindir,
|
||||||
'-B', $newbindir, '-s', $newnode->host,
|
'-B', $newbindir, '-s', $newnode->host,
|
||||||
'-p', $oldnode->port, '-P', $newnode->port
|
'-p', $oldnode->port, '-P', $newnode->port,
|
||||||
|
$mode,
|
||||||
],
|
],
|
||||||
'run of pg_upgrade for new instance');
|
'run of pg_upgrade for new instance');
|
||||||
ok( !-d $newnode->data_dir . "/pg_upgrade_output.d",
|
ok( !-d $newnode->data_dir . "/pg_upgrade_output.d",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user