diff --git a/testgres/node.py b/testgres/node.py index 84c25327..52e6d2ee 100644 --- a/testgres/node.py +++ b/testgres/node.py @@ -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 @@ -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: diff --git a/testgres/operations/local_ops.py b/testgres/operations/local_ops.py index a692750e..36b14058 100644 --- a/testgres/operations/local_ops.py +++ b/testgres/operations/local_ops.py @@ -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