From 49861815c1cf76658a77cf8ade59c4bb61c4064b Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 14 Dec 2022 08:02:57 +0100 Subject: [PATCH v2 2/2] 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.) Discussion: https://www.postgresql.org/message-id/flat/50a97009-8ff9-ca4d-a0f6-6086a6775a5b%40enterprisedb.com --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index add6ea9c34..1d5c80907c 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -12,6 +12,9 @@ use PostgreSQL::Test::Utils; 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. sub generate_db { @@ -75,6 +78,8 @@ sub filter_dump my $dump1_file = "$tempdir/dump1.sql"; my $dump2_file = "$tempdir/dump2.sql"; +note "testing using transfer mode $mode"; + # Initialize node to upgrade my $oldnode = PostgreSQL::Test::Cluster->new('old_node', @@ -128,6 +133,7 @@ sub filter_dump # --inputdir points to the path of the input files. my $inputdir = "$srcdir/src/test/regress"; + note 'running regression tests in old instance'; my $rc = system($ENV{PG_REGRESS} . " $extra_opts " @@ -256,6 +262,7 @@ sub filter_dump '-s', $newnode->host, '-p', $oldnode->port, '-P', $newnode->port, + $mode, '--check' ], 'run of pg_upgrade --check for new instance with incorrect binary path'); @@ -270,6 +277,7 @@ sub filter_dump '-D', $newnode->data_dir, '-b', $oldbindir, '-B', $newbindir, '-s', $newnode->host, '-p', $oldnode->port, '-P', $newnode->port, + $mode, '--check' ], 'run of pg_upgrade --check for new instance'); @@ -282,7 +290,8 @@ sub filter_dump 'pg_upgrade', '--no-sync', '-d', $oldnode->data_dir, '-D', $newnode->data_dir, '-b', $oldbindir, '-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'); ok( !-d $newnode->data_dir . "/pg_upgrade_output.d", -- 2.38.1