Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add skip_vendor_specific_container argument option for test_monitoring_critical_processes #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
28 changes: 28 additions & 0 deletions tests/process_monitoring/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import pytest


def pytest_addoption(parser):
parser.addoption(
"--skip_vendor_specific_container",
action="store",
default="",
required=False,
help="skip vendor specific container list"
)


@pytest.fixture(scope="module", autouse=True)
def skip_vendor_specific_container(request):
""" This fixture is to get the skipping vendor container list and return the container information

For example:
pytest --skip_vendor_specific_container "container1, container2" <other arguments>
pytest --skip_vendor_specific_container container1, container2 <other arguments>

"""
skip_vendor_specific_container_opt = request.config.getoption("--skip_vendor_specific_container", default="")
vendor_specific_container = []
if skip_vendor_specific_container_opt:
vendor_specific_container = [container.strip() for container in skip_vendor_specific_container_opt.split(",")]

return vendor_specific_container
3 changes: 2 additions & 1 deletion tests/process_monitoring/test_critical_process_monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ def ensure_all_critical_processes_running(duthost, containers_in_namespaces):
ensure_process_is_running(duthost, container_name_in_namespace, program_name)


def test_monitoring_critical_processes(duthosts, rand_one_dut_hostname, tbinfo):
def test_monitoring_critical_processes(duthosts, rand_one_dut_hostname, tbinfo, skip_vendor_specific_container):
"""Tests the feature of monitoring critical processes by Monit and Supervisord.

This function will check whether names of critical processes will appear
Expand Down Expand Up @@ -548,6 +548,7 @@ def test_monitoring_critical_processes(duthosts, rand_one_dut_hostname, tbinfo):
# Skip 'acms' container since 'acms' process is not running on lab devices and
# another process `cert_converter.py' is set to auto-restart if exited.
skip_containers.append("acms")
skip_containers = skip_containers + skip_vendor_specific_container
# Skip 'radv' container on devices whose role is not T0.
if tbinfo["topo"]["type"] != "t0":
skip_containers.append("radv")
Expand Down