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
17 changes: 15 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@

SINGLE_ASIC_VOQ_FS = "single_asic_voq_fs"

def get_dvs_service_ready_timeout():
try:
return int(os.environ.get("DVS_SERVICE_READY_TIMEOUT", "180"))
except ValueError:
return 180

DEFAULT_DVS_SERVICE_READY_TIMEOUT = get_dvs_service_ready_timeout()

def ensure_system(cmd):
rc, output = subprocess.getstatusoutput(cmd)
if rc:
Expand Down Expand Up @@ -564,7 +572,7 @@ def check_ready_status_and_init_db(self) -> None:
self.destroy()
raise

def check_services_ready(self, timeout=60) -> None:
def check_services_ready(self, timeout=DEFAULT_DVS_SERVICE_READY_TIMEOUT) -> None:
"""Check if all processes in the DVS are ready."""
service_polling_config = PollingConfig(1, timeout, strict=True)

Expand Down Expand Up @@ -1951,14 +1959,16 @@ def update_dvs(log_path, new_dvs_env=[]):
if dvs is not None:
dvs.get_logs()
dvs.destroy()
dvs = None

vol = {}
if switch_mode and switch_mode == SINGLE_ASIC_VOQ_FS:
cwd = os.getcwd()
voq_configs = cwd + "/single_asic_voq_fs"
vol[voq_configs] = {"bind": "/usr/share/sonic/single_asic_voq_fs", "mode": "ro"}

dvs = DockerVirtualSwitch(name, imgname, keeptb, new_dvs_env, log_path, max_cpu, forcedvs, buffer_model = buffer_model, enable_coverage=enable_coverage, ctnmounts=vol, switch_mode=switch_mode)
new_dvs = DockerVirtualSwitch(name, imgname, keeptb, new_dvs_env, log_path, max_cpu, forcedvs, buffer_model = buffer_model, enable_coverage=enable_coverage, ctnmounts=vol, switch_mode=switch_mode)
dvs = new_dvs

curr_dvs_env = new_dvs_env

Expand All @@ -1977,6 +1987,9 @@ def update_dvs(log_path, new_dvs_env=[]):

yield update_dvs

if dvs is None:
return

if graceful_stop:
dvs.stop_swss()
dvs.stop_syncd()
Expand Down
Loading