Skip to content

Commit 1e2255f

Browse files
authored
Merge pull request #91 from postgrespro/username-in-start-node
Change setting user in start_node
2 parents 291bcec + fd11545 commit 1e2255f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

testgres/node.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ def get_control_data(self):
659659

660660
return out_dict
661661

662-
def slow_start(self, replica=False, dbname='template1', username=default_username(), max_attempts=0):
662+
def slow_start(self, replica=False, dbname='template1', username=None, max_attempts=0):
663663
"""
664664
Starts the PostgreSQL instance and then polls the instance
665665
until it reaches the expected state (primary or replica). The state is checked
@@ -672,6 +672,8 @@ def slow_start(self, replica=False, dbname='template1', username=default_usernam
672672
If False, waits for the instance to be in primary mode. Default is False.
673673
max_attempts:
674674
"""
675+
if not username:
676+
username = default_username()
675677
self.start()
676678

677679
if replica:

testgres/operations/local_ops.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def set_env(self, var_name, var_val):
117117

118118
# Get environment variables
119119
def get_user(self):
120-
return getpass.getuser()
120+
return self.username or getpass.getuser()
121121

122122
def get_name(self):
123123
return os.name

0 commit comments

Comments
 (0)