Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
caa6c1f1
Commit
caa6c1f1
authored
Feb 26, 2017
by
Robert Haas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TAP tests for target_session_attrs connection parameter.
Michael Paquier
parent
9d1fb11a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
1 deletion
+49
-1
src/test/recovery/t/001_stream_rep.pl
src/test/recovery/t/001_stream_rep.pl
+49
-1
No files found.
src/test/recovery/t/001_stream_rep.pl
View file @
caa6c1f1
...
...
@@ -3,7 +3,7 @@ use strict;
use
warnings
;
use
PostgresNode
;
use
TestLib
;
use
Test::
More
tests
=>
2
4
;
use
Test::
More
tests
=>
2
8
;
# Initialize master node
my
$node_master
=
get_new_node
('
master
');
...
...
@@ -59,6 +59,54 @@ is($node_standby_1->psql('postgres', 'INSERT INTO tab_int VALUES (1)'),
is
(
$node_standby_2
->
psql
('
postgres
',
'
INSERT INTO tab_int VALUES (1)
'),
3
,
'
read-only queries on standby 2
');
# Tests for connection parameter target_session_attrs
diag
"
testing connection parameter
\"
target_session_attrs
\"
";
# Routine designed to run tests on the connection parameter
# target_session_attrs with multiple nodes.
sub
test_target_session_attrs
{
my
$node1
=
shift
;
my
$node2
=
shift
;
my
$target_node
=
shift
;
my
$mode
=
shift
;
my
$status
=
shift
;
my
$node1_host
=
$node1
->
host
;
my
$node1_port
=
$node1
->
port
;
my
$node1_name
=
$node1
->
name
;
my
$node2_host
=
$node2
->
host
;
my
$node2_port
=
$node2
->
port
;
my
$node2_name
=
$node2
->
name
;
my
$target_name
=
$target_node
->
name
;
# Build connection string for connection attempt.
my
$connstr
=
"
host=
$node1_host
,
$node2_host
";
$connstr
.=
"
port=
$node1_port
,
$node2_port
";
$connstr
.=
"
target_session_attrs=
$mode
";
# The client used for the connection does not matter, only the backend
# point does.
my
(
$ret
,
$stdout
,
$stderr
)
=
$node1
->
psql
('
postgres
',
'
SHOW port;
',
extra_params
=>
['
-d
',
$connstr
]);
is
(
$status
==
$ret
&&
$stdout
eq
$target_node
->
port
,
1
,
"
connect to node
$target_name
if mode
\"
$mode
\"
and
$node1_name
,
$node2_name
listed
");
}
# Connect to master in "read-write" mode with master,standby1 list.
test_target_session_attrs
(
$node_master
,
$node_standby_1
,
$node_master
,
"
read-write
",
0
);
# Connect to master in "read-write" mode with standby1,master list.
test_target_session_attrs
(
$node_standby_1
,
$node_master
,
$node_master
,
"
read-write
",
0
);
# Connect to master in "any" mode with master,standby1 list.
test_target_session_attrs
(
$node_master
,
$node_standby_1
,
$node_master
,
"
any
",
0
);
# Connect to standby1 in "any" mode with standby1,master list.
test_target_session_attrs
(
$node_standby_1
,
$node_master
,
$node_standby_1
,
"
any
",
0
);
diag
"
switching to physical replication slot
";
# Switch to using a physical replication slot. We can do this without a new
# backup since physical slots can go backwards if needed. Do so on both
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment