# HG changeset patch # User RhodeCode Admin # Date 2023-03-20 20:01:14 # Node ID 6c82c462f8ec308d3e148ade39a57bc20cde6ffd # Parent 0b11b7dc228b032db99b3fc3a1f84ae830740382 tests: fixed starting of customized gunicorn with a explicit --bind call diff --git a/rhodecode/tests/pylons_plugin.py b/rhodecode/tests/pylons_plugin.py --- a/rhodecode/tests/pylons_plugin.py +++ b/rhodecode/tests/pylons_plugin.py @@ -176,8 +176,8 @@ def ini_config(request, tmpdir_factory, }}, {'handler_console': { - 'class ': 'StreamHandler', - 'args ': '(sys.stderr,)', + 'class': 'StreamHandler', + 'args': '(sys.stderr,)', 'level': log_level, }}, diff --git a/rhodecode/tests/server_utils.py b/rhodecode/tests/server_utils.py --- a/rhodecode/tests/server_utils.py +++ b/rhodecode/tests/server_utils.py @@ -83,12 +83,17 @@ class ServerBase(object): return ' '.join(self._args) @property + def bind_addr(self): + return '{host}:{port}'.format(**self._config) + + @property def http_url(self): template = 'http://{host}:{port}/' return template.format(**self._config) def host_url(self): - return 'http://' + get_host_url(self.config_file) + host = get_host_url(self.config_file) + return f'http://{host}' def get_rc_log(self): with open(self.log_file) as f: @@ -137,7 +142,9 @@ class RcVCSServer(ServerBase): def __init__(self, config_file, log_file=None): super(RcVCSServer, self).__init__(config_file, log_file) - self._args = ['gunicorn', '--paste', self.config_file] + self._args = [ + 'gunicorn', '--bind', self.bind_addr, + '--paste', self.config_file] def start(self): env = os.environ.copy() @@ -148,10 +155,9 @@ class RcVCSServer(ServerBase): host_url = self.host_url() assert_no_running_instance(host_url) - log.info('rhodecode-vcsserver start command: {}'.format(' '.join(self._args))) - log.info('rhodecode-vcsserver starting at: {}'.format(host_url)) - log.info('rhodecode-vcsserver command: {}'.format(self.command)) - log.info('rhodecode-vcsserver logfile: {}'.format(self.log_file)) + print(f'rhodecode-vcsserver starting at: {host_url}') + print(f'rhodecode-vcsserver command: {self.command}') + print(f'rhodecode-vcsserver logfile: {self.log_file}') self.process = subprocess.Popen( self._args, bufsize=0, env=env, @@ -169,7 +175,8 @@ class RcWebServer(ServerBase): def __init__(self, config_file, log_file=None): super(RcWebServer, self).__init__(config_file, log_file) self._args = [ - 'gunicorn', '--worker-class', 'gevent', '--paste', config_file] + 'gunicorn', '--bind', self.bind_addr, '--worker-class', 'gevent', + '--paste', self.config_file] def start(self): env = os.environ.copy() @@ -181,9 +188,9 @@ class RcWebServer(ServerBase): host_url = self.host_url() assert_no_running_instance(host_url) - log.info('rhodecode-web starting at: {}'.format(host_url)) - log.info('rhodecode-web command: {}'.format(self.command)) - log.info('rhodecode-web logfile: {}'.format(self.log_file)) + print(f'rhodecode-web starting at: {host_url}') + print(f'rhodecode-web command: {self.command}') + print(f'rhodecode-web logfile: {self.log_file}') self.process = subprocess.Popen( self._args, bufsize=0, env=env,