Skip to content

Commit

Permalink
status server uris sync up
Browse files Browse the repository at this point in the history
When user sets only one of the status server values (uri, listen) Then
the avocado will stop working because it will listen on different uri
than the messages will be sent. This change will synchronize these
values if the user sets only one of them.

Reference: #5740
Signed-off-by: Jan Richter <[email protected]>
  • Loading branch information
richtja committed Aug 11, 2023
1 parent 5d72c04 commit 099eb19
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions avocado/plugins/runner_nrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
from avocado.core.task.runtime import RuntimeTaskGraph
from avocado.core.task.statemachine import TaskStateMachine, Worker

DEFAULT_SERVER_URI = "127.0.0.1:8888"


class RunnerInit(Init):

Expand Down Expand Up @@ -74,7 +76,7 @@ def initialize(self):
settings.register_option(
section=section,
key="status_server_listen",
default="127.0.0.1:8888",
default=DEFAULT_SERVER_URI,
metavar="HOST:PORT",
help_msg=help_msg,
)
Expand All @@ -88,7 +90,7 @@ def initialize(self):
settings.register_option(
section=section,
key="status_server_uri",
default="127.0.0.1:8888",
default=DEFAULT_SERVER_URI,
metavar="HOST:PORT",
help_msg=help_msg,
)
Expand Down Expand Up @@ -229,7 +231,23 @@ def _determine_status_server(self, test_suite, config_key):
return os.path.join(self.status_server_dir.name, ".status_server.sock")
return test_suite.config.get(config_key)

def _sync_status_server_urls(self, config):
server_listen = config.get("run.status_server_listen")
server_uri = config.get("run.status_server_uri")
if not config.get("run.status_server_auto"):
if (
server_uri is not DEFAULT_SERVER_URI
and server_listen is DEFAULT_SERVER_URI
):
config["run.status_server_listen"] = server_uri
if (
server_uri is DEFAULT_SERVER_URI
and server_listen is not DEFAULT_SERVER_URI
):
config["run.status_server_uri"] = server_listen

def _create_status_server(self, test_suite, job):
self._sync_status_server_urls(test_suite.config)
listen = self._determine_status_server(test_suite, "run.status_server_listen")
# pylint: disable=W0201
self.status_repo = StatusRepo(job.unique_id)
Expand Down

0 comments on commit 099eb19

Please sign in to comment.