Skip to content

Change setting user in start_node #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion testgres/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ def get_control_data(self):

return out_dict

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

if replica:
Expand Down
2 changes: 1 addition & 1 deletion testgres/operations/local_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def set_env(self, var_name, var_val):

# Get environment variables
def get_user(self):
return getpass.getuser()
return self.username or getpass.getuser()

def get_name(self):
return os.name
Expand Down