@@ -126,7 +126,7 @@ def __repr__(self):
126
126
127
127
128
128
class PostgresNode (object ):
129
- def __init__ (self , name = None , port = None , base_dir = None , conn_params : ConnectionParams = ConnectionParams (), bin_dir = None , prefix = None ):
129
+ def __init__ (self , name = None , base_dir = None , port = None , conn_params : ConnectionParams = ConnectionParams (), bin_dir = None , prefix = None ):
130
130
"""
131
131
PostgresNode constructor.
132
132
@@ -527,7 +527,9 @@ def get_auth_method(t):
527
527
u"host\t replication\t all\t 127.0.0.1/32\t {}\n " .format (auth_host ),
528
528
u"host\t replication\t all\t ::1/128\t \t {}\n " .format (auth_host ),
529
529
u"host\t replication\t all\t {}/24\t \t {}\n " .format (subnet_base , auth_host ),
530
- u"host\t all\t all\t {}/24\t \t {}\n " .format (subnet_base , auth_host )
530
+ u"host\t all\t all\t {}/24\t \t {}\n " .format (subnet_base , auth_host ),
531
+ u"host\t all\t all\t all\t {}\n " .format (auth_host ),
532
+ u"host\t replication\t all\t all\t {}\n " .format (auth_host )
531
533
] # yapf: disable
532
534
533
535
# write missing lines
@@ -1670,37 +1672,45 @@ def _get_bin_path(self, filename):
1670
1672
1671
1673
class NodeApp :
1672
1674
1673
- def __init__ (self , test_path , nodes_to_cleanup , os_ops = LocalOperations ()):
1674
- self .test_path = test_path
1675
- self .nodes_to_cleanup = nodes_to_cleanup
1675
+ def __init__ (self , test_path = None , nodes_to_cleanup = None , os_ops = LocalOperations ()):
1676
+ print ('ALEXEY in nodeapp init' , test_path )
1677
+ if test_path :
1678
+ if os .path .isabs (test_path ):
1679
+ self .test_path = test_path
1680
+ else :
1681
+ self .test_path = os .path .join (os_ops .cwd (), test_path )
1682
+ else :
1683
+ self .test_path = os_ops .cwd ()
1684
+ print ('ALEXEY in nodeapp resulting test path' , self .test_path )
1685
+ self .nodes_to_cleanup = nodes_to_cleanup if nodes_to_cleanup else []
1676
1686
self .os_ops = os_ops
1677
1687
1678
1688
def make_empty (
1679
1689
self ,
1680
- port = None ,
1681
- base_dir = None ):
1690
+ base_dir = None ,
1691
+ port = None ):
1682
1692
real_base_dir = os .path .join (self .test_path , base_dir )
1683
1693
self .os_ops .rmdirs (real_base_dir , ignore_errors = True )
1684
1694
self .os_ops .makedirs (real_base_dir )
1685
1695
1686
- node = PostgresNode (port = port , base_dir = real_base_dir )
1696
+ node = PostgresNode (base_dir = real_base_dir , port = port )
1687
1697
node .should_rm_dirs = True
1688
1698
self .nodes_to_cleanup .append (node )
1689
1699
1690
1700
return node
1691
1701
1692
1702
def make_simple (
1693
1703
self ,
1694
- port = None ,
1695
1704
base_dir = None ,
1705
+ port = None ,
1696
1706
set_replication = False ,
1697
1707
ptrack_enable = False ,
1698
1708
initdb_params = [],
1699
1709
pg_options = {},
1700
1710
checksum = True ):
1701
1711
if checksum and '--data-checksums' not in initdb_params :
1702
1712
initdb_params .append ('--data-checksums' )
1703
- node = self .make_empty (base_dir )
1713
+ node = self .make_empty (base_dir , port )
1704
1714
node .init (
1705
1715
initdb_params = initdb_params , allow_streaming = set_replication )
1706
1716
0 commit comments