Skip to content
Open
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
11 changes: 7 additions & 4 deletions tests-functional/clients/status_backend.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import itertools
import logging
import os
import tempfile
Expand Down Expand Up @@ -36,6 +37,8 @@

class StatusBackend(RpcClient, SignalClient, ApiClient):
container = None
_media_server_port_gen = itertools.count(constants.STATUS_MEDIA_SERVER_PORT, 1)
_connector_ws_port_gen = itertools.count(constants.STATUS_CONNECTOR_WS_PORT, 1)

def __init__(self, await_signals=[], privileged=False, ipv6=USE_IPV6, **kwargs):
self.temp_dir = None
Expand All @@ -52,8 +55,8 @@ def __init__(self, await_signals=[], privileged=False, ipv6=USE_IPV6, **kwargs):
self.temp_dir = tempfile.TemporaryDirectory()
self.data_dir = self.temp_dir.name
if kwargs.get("connector_enabled", False):
self.connector_ws_url = f"ws://localhost:{constants.STATUS_CONNECTOR_WS_PORT}"
self.media_server_port = constants.STATUS_MEDIA_SERVER_PORT
self.connector_ws_url = f"ws://localhost:{next(StatusBackend._connector_ws_port_gen)}"
self.media_server_port = next(StatusBackend._media_server_port_gen)
else:
self.container = StatusBackendContainer(privileged, self.ipv6, **kwargs)
self.temp_dir = None
Expand Down Expand Up @@ -142,8 +145,8 @@ def init_status_backend(self):
"apiLoggingEnabled": True,
"wakuFleetsConfigFilePath": Config.waku_fleets_config,
"pushFleetsConfigFilePath": Config.push_fleets_config,
"mediaServerAddress": f"""{"0.0.0.0" if self.container else "localhost"}:{constants.STATUS_MEDIA_SERVER_PORT}""",
"mediaServerAdvertizeHost": "localhost" if self.container else "",
"mediaServerAddress": f"""{"0.0.0.0" if self.container else "127.0.0.1"}:{self.media_server_port}""",
"mediaServerAdvertizeHost": "127.0.0.1" if self.container else "",
"mediaServerAdvertizePort": self.container.media_server_port if self.container else 0,
}

Expand Down