|
|
@ -5,6 +5,7 @@ |
|
|
|
use strict; |
|
|
|
use strict; |
|
|
|
use warnings; |
|
|
|
use warnings; |
|
|
|
use PostgreSQL::Test::Cluster; |
|
|
|
use PostgreSQL::Test::Cluster; |
|
|
|
|
|
|
|
use PostgreSQL::Test::Utils; |
|
|
|
use Test::More; |
|
|
|
use Test::More; |
|
|
|
|
|
|
|
|
|
|
|
my ($node_publisher, $node_subscriber, $publisher_connstr, $result, $offset); |
|
|
|
my ($node_publisher, $node_subscriber, $publisher_connstr, $result, $offset); |
|
|
@ -306,7 +307,12 @@ expect_replication("alice.unpartitioned", 3, 17, 21, |
|
|
|
# If the subscription connection requires a password ('password_required' |
|
|
|
# If the subscription connection requires a password ('password_required' |
|
|
|
# is true) then a non-superuser must specify that password in the connection |
|
|
|
# is true) then a non-superuser must specify that password in the connection |
|
|
|
# string. |
|
|
|
# string. |
|
|
|
$ENV{"PGPASSWORD"} = 'secret'; |
|
|
|
SKIP: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
skip |
|
|
|
|
|
|
|
"subscription password_required test cannot run without Unix-domain sockets", |
|
|
|
|
|
|
|
3 |
|
|
|
|
|
|
|
unless $use_unix_sockets; |
|
|
|
|
|
|
|
|
|
|
|
my $node_publisher1 = PostgreSQL::Test::Cluster->new('publisher1'); |
|
|
|
my $node_publisher1 = PostgreSQL::Test::Cluster->new('publisher1'); |
|
|
|
my $node_subscriber1 = PostgreSQL::Test::Cluster->new('subscriber1'); |
|
|
|
my $node_subscriber1 = PostgreSQL::Test::Cluster->new('subscriber1'); |
|
|
@ -344,6 +350,9 @@ CREATE SUBSCRIPTION regress_test_sub CONNECTION '$publisher_connstr1' PUBLICATIO |
|
|
|
$node_subscriber1->wait_for_subscription_sync($node_publisher1, |
|
|
|
$node_subscriber1->wait_for_subscription_sync($node_publisher1, |
|
|
|
'regress_test_sub'); |
|
|
|
'regress_test_sub'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $save_pgpassword = $ENV{"PGPASSWORD"}; |
|
|
|
|
|
|
|
$ENV{"PGPASSWORD"} = 'secret'; |
|
|
|
|
|
|
|
|
|
|
|
# Setup pg_hba configuration so that logical replication connection without |
|
|
|
# Setup pg_hba configuration so that logical replication connection without |
|
|
|
# password is not allowed. |
|
|
|
# password is not allowed. |
|
|
|
unlink($node_publisher1->data_dir . '/pg_hba.conf'); |
|
|
|
unlink($node_publisher1->data_dir . '/pg_hba.conf'); |
|
|
@ -366,11 +375,12 @@ ALTER SUBSCRIPTION regress_test_sub REFRESH PUBLICATION; |
|
|
|
isnt($ret, 0, |
|
|
|
isnt($ret, 0, |
|
|
|
"non zero exit for subscription whose owner is a non-superuser must specify password parameter of the connection string" |
|
|
|
"non zero exit for subscription whose owner is a non-superuser must specify password parameter of the connection string" |
|
|
|
); |
|
|
|
); |
|
|
|
ok( $stderr =~ m/DETAIL: Non-superusers must provide a password in the connection string./, |
|
|
|
ok( $stderr =~ |
|
|
|
|
|
|
|
m/DETAIL: Non-superusers must provide a password in the connection string./, |
|
|
|
'subscription whose owner is a non-superuser must specify password parameter of the connection string' |
|
|
|
'subscription whose owner is a non-superuser must specify password parameter of the connection string' |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
delete $ENV{"PGPASSWORD"}; |
|
|
|
$ENV{"PGPASSWORD"} = $save_pgpassword; |
|
|
|
|
|
|
|
|
|
|
|
# It should succeed after including the password parameter of the connection |
|
|
|
# It should succeed after including the password parameter of the connection |
|
|
|
# string. |
|
|
|
# string. |
|
|
@ -383,4 +393,5 @@ ALTER SUBSCRIPTION regress_test_sub REFRESH PUBLICATION; |
|
|
|
is($ret, 0, |
|
|
|
is($ret, 0, |
|
|
|
"Non-superuser will be able to refresh the publication after specifying the password parameter of the connection string" |
|
|
|
"Non-superuser will be able to refresh the publication after specifying the password parameter of the connection string" |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
done_testing(); |
|
|
|
done_testing(); |
|
|
|