Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 926f5ce

Browse filesBrowse files
committed
pg_basebackup: Adjust tests for long file name issues
Work around accidental test failures because the working directory path is too long by creating a temporary directory in the (hopefully shorter) system location, symlinking that to the working directory, and creating the tablespaces using the shorter path.
1 parent 552faef commit 926f5ce
Copy full SHA for 926f5ce

File tree

Expand file treeCollapse file tree

1 file changed

+11
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-4
lines changed

‎src/bin/pg_basebackup/t/010_pg_basebackup.pl

Copy file name to clipboardExpand all lines: src/bin/pg_basebackup/t/010_pg_basebackup.pl
+11-4Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,15 @@
4949
'tar format');
5050
ok(-f "$tempdir/tarbackup/base.tar", 'backup tar was created');
5151

52+
# Create a temporary directory in the system location and symlink it
53+
# to our physical temp location. That way we can use shorter names
54+
# for the tablespace directories, which hopefully won't run afoul of
55+
# the 99 character length limit.
56+
my $shorter_tempdir = tempdir_short . "/tempdir";
57+
symlink "$tempdir", $shorter_tempdir;
58+
5259
mkdir "$tempdir/tblspc1";
53-
psql 'postgres', "CREATE TABLESPACE tblspc1 LOCATION '$tempdir/tblspc1';";
60+
psql 'postgres', "CREATE TABLESPACE tblspc1 LOCATION '$shorter_tempdir/tblspc1';";
5461
psql 'postgres', "CREATE TABLE test1 (a int) TABLESPACE tblspc1;";
5562
command_ok([ 'pg_basebackup', '-D', "$tempdir/tarbackup2", '-Ft' ],
5663
'tar format with tablespaces');
@@ -65,7 +72,7 @@
6572
command_ok(
6673
[ 'pg_basebackup', '-D',
6774
"$tempdir/backup1", '-Fp',
68-
"-T$tempdir/tblspc1=$tempdir/tbackup/tblspc1" ],
75+
"-T$shorter_tempdir/tblspc1=$tempdir/tbackup/tblspc1" ],
6976
'plain format with tablespaces succeeds with tablespace mapping');
7077
ok(-d "$tempdir/tbackup/tblspc1", 'tablespace was relocated');
7178
opendir(my $dh, "$tempdir/pgdata/pg_tblspc") or die;
@@ -81,11 +88,11 @@
8188
mkdir "$tempdir/tbl=spc2";
8289
psql 'postgres', "DROP TABLE test1;";
8390
psql 'postgres', "DROP TABLESPACE tblspc1;";
84-
psql 'postgres', "CREATE TABLESPACE tblspc2 LOCATION '$tempdir/tbl=spc2';";
91+
psql 'postgres', "CREATE TABLESPACE tblspc2 LOCATION '$shorter_tempdir/tbl=spc2';";
8592
command_ok(
8693
[ 'pg_basebackup', '-D',
8794
"$tempdir/backup3", '-Fp',
88-
"-T$tempdir/tbl\\=spc2=$tempdir/tbackup/tbl\\=spc2" ],
95+
"-T$shorter_tempdir/tbl\\=spc2=$tempdir/tbackup/tbl\\=spc2" ],
8996
'mapping tablespace with = sign in path');
9097
ok(-d "$tempdir/tbackup/tbl=spc2", 'tablespace with = sign was relocated');
9198

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.