Skip to content

Commit 48938ab

Browse files
authored
[OSS-Only] Use stable PG 15 dump utilities in TAP Test (#4686)
Updated dump/restore tap-tests to use v15 dump utility to dump older versions. Task: No-Jira Signed-off-by: Rucha Kulkarni <ruchask@amazon.com>
1 parent b0662b8 commit 48938ab

File tree

2 files changed

+35
-15
lines changed

2 files changed

+35
-15
lines changed

.github/workflows/tap-tests.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ jobs:
88
NEW_INSTALL_DIR: psql_target
99
ENGINE_BRANCH_OLD: BABEL_2_6_STABLE__PG_14_9
1010
EXTENSION_BRANCH_OLD: BABEL_2_6_STABLE
11+
INSTALL_DIR_15: psql15
12+
ENGINE_BRANCH_15: BABEL_3_9_STABLE__PG_15_12
1113

1214
runs-on: ubuntu-22.04
1315
steps:
@@ -36,9 +38,17 @@ jobs:
3638
sudo -E apt-get install krb5-admin-server krb5-kdc krb5-user libkrb5-dev -y -qq
3739
shell: bash
3840

41+
- name: Build Modified Postgres using ${{env.ENGINE_BRANCH_15}}
42+
id: build-modified-postgres-15
43+
if: always() && steps.install-kerberos-dependencies.outcome == 'success'
44+
uses: ./.github/composite-actions/build-modified-postgres
45+
with:
46+
engine_branch: ${{env.ENGINE_BRANCH_15}}
47+
install_dir: ${{env.INSTALL_DIR_15}}
48+
3949
- name: Build Modified Postgres using ${{env.ENGINE_BRANCH_OLD}}
4050
id: build-modified-postgres-old
41-
if: always() && steps.install-kerberos-dependencies.outcome == 'success'
51+
if: always() && steps.build-modified-postgres-15.outcome == 'success'
4252
uses: ./.github/composite-actions/build-modified-postgres
4353
with:
4454
engine_branch: ${{env.ENGINE_BRANCH_OLD}}
@@ -133,6 +143,7 @@ jobs:
133143
export PG_CONFIG=~/${{env.NEW_INSTALL_DIR}}/bin/pg_config
134144
export PATH=/opt/mssql-tools/bin:$PATH
135145
export oldinstall=$HOME/${{env.OLD_INSTALL_DIR}}
146+
export installdir15=$HOME/${{env.INSTALL_DIR_15}}
136147
137148
cd contrib/babelfishpg_tds
138149
make installcheck PROVE_TESTS="t/001_tdspasswd.pl t/002_tdskerberos.pl t/003_bbfextnotloaded.pl t/004_bbfdumprestore.pl"

contrib/babelfishpg_tds/test/t/004_bbfdumprestore.pl

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,29 @@
6565
$tsql_newnode->init_tsql('test_master', 'testdb');
6666
$newnode->stop;
6767

68+
# Setup pg16 node
69+
my $node15 =
70+
PostgreSQL::Test::Cluster->new('node_15',
71+
install_path => $ENV{installdir15});
72+
73+
my $newbindir = $newnode->config_data('--bindir');
74+
my $oldbindir = $oldnode->config_data('--bindir');
75+
my $bindir15 = $node15->config_data('--bindir');
76+
6877
# Dump global objects using pg_dumpall. Note that we
6978
# need to use dump utilities from the new node here.
7079
$oldnode->start;
7180
my @dumpall_command = (
72-
'pg_dumpall', '--database', 'testdb', '--username', 'test_master',
81+
$bindir15 . '/pg_dumpall', '--database', 'testdb', '--username', 'test_master',
7382
'--port', $oldnode->port, '--roles-only', '--quote-all-identifiers',
7483
'--verbose', '--no-role-passwords', '--file', $dump1_file);
75-
$newnode->command_ok(\@dumpall_command, 'Dump global objects.');
84+
$node15->command_ok(\@dumpall_command, 'Dump global objects.');
7685
# Dump Babelfish database using pg_dump.
7786
my @dump_command = (
78-
'pg_dump', '--username', 'test_master', '--quote-all-identifiers',
87+
$bindir15 . '/pg_dump', '--username', 'test_master', '--quote-all-identifiers',
7988
'--port', $oldnode->port, '--verbose', '--dbname', 'testdb',
8089
'--file', $dump2_file);
81-
$newnode->command_ok(\@dump_command, 'Dump Babelfish database.');
90+
$node15->command_ok(\@dump_command, 'Dump Babelfish database.');
8291
$oldnode->stop;
8392

8493
# Retore the dumped files on the new server.
@@ -88,7 +97,7 @@
8897
# dump/restore is not yet supported.
8998
$newnode->command_fails_like(
9099
[
91-
'psql',
100+
$newbindir . '/psql',
92101
'-d', 'testdb',
93102
'-U', 'test_master',
94103
'-p', $newnode->port,
@@ -101,7 +110,7 @@
101110
# Similarly, restore of dump file should also cause a failure.
102111
$newnode->command_fails_like(
103112
[
104-
'psql',
113+
$newbindir . '/psql',
105114
'-d', 'testdb',
106115
'-U', 'test_master',
107116
'-p', $newnode->port,
@@ -117,7 +126,7 @@
117126

118127
$oldnode->command_fails_like(
119128
[
120-
'psql',
129+
$oldbindir . '/psql',
121130
'-d', 'testdb',
122131
'-U', 'test_master',
123132
'-p', $oldnode->port,
@@ -129,7 +138,7 @@
129138

130139
$oldnode->command_fails_like(
131140
[
132-
'psql',
141+
$oldbindir . '/psql',
133142
'-d', 'testdb',
134143
'-U', 'test_master',
135144
'-p', $oldnode->port,
@@ -162,14 +171,14 @@
162171
# Dump global objects using pg_dumpall. Note that we
163172
# need to use dump utilities from the new node here.
164173
@dumpall_command = (
165-
'pg_dumpall', '--database', 'testdb', '--username', 'test_master',
174+
$newbindir . '/pg_dumpall', '--database', 'testdb', '--username', 'test_master',
166175
'--port', $newnode2->port, '--roles-only', '--quote-all-identifiers',
167176
'--verbose', '--no-role-passwords', '--file', $dump3_file);
168177
$newnode2->command_ok(\@dumpall_command, 'Dump global objects.');
169178
# Dump Babelfish database using pg_dump. Let's dump with the custom format
170179
# this time so that we cover pg_restore as well.
171180
@dump_command = (
172-
'pg_dump', '--username', 'test_master', '--quote-all-identifiers',
181+
$newbindir . '/pg_dump', '--username', 'test_master', '--quote-all-identifiers',
173182
'--port', $newnode2->port, '--verbose', '--dbname', 'testdb',
174183
'--format', 'custom', '--file', $dump4_file);
175184
$newnode2->command_ok(\@dump_command, 'Dump Babelfish database.');
@@ -182,7 +191,7 @@
182191
# dump/restore is not yet supported.
183192
$newnode->command_fails_like(
184193
[
185-
'psql',
194+
$newbindir . '/psql',
186195
'-d', 'testdb',
187196
'-U', 'test_master',
188197
'-p', $newnode->port,
@@ -195,7 +204,7 @@
195204
# Similarly, restore of dump file should also cause a failure.
196205
$newnode->command_fails_like(
197206
[
198-
'pg_restore',
207+
$newbindir . '/pg_restore',
199208
'-d', 'testdb',
200209
'-U', 'test_master',
201210
'-p', $newnode->port,
@@ -213,13 +222,13 @@
213222

214223
# Dump global objects using pg_dumpall.
215224
@dumpall_command = (
216-
'pg_dumpall', '--database', 'postgres', '--port', $newnode->port,
225+
$newbindir . '/pg_dumpall', '--database', 'postgres', '--port', $newnode->port,
217226
'--roles-only', '--quote-all-identifiers', '--verbose',
218227
'--no-role-passwords', '--file', $dump1_file);
219228
$newnode->command_ok(\@dumpall_command, 'Dump global objects.');
220229
# Dump Babelfish database using pg_dump.
221230
@dump_command = (
222-
'pg_dump', '--quote-all-identifiers', '--port', $newnode->port,
231+
$newbindir . '/pg_dump', '--quote-all-identifiers', '--port', $newnode->port,
223232
'--verbose', '--dbname', 'postgres',
224233
'--file', $dump2_file);
225234
$newnode->command_ok(\@dump_command, 'Dump non-Babelfish (postgres db) database.');

0 commit comments

Comments
 (0)