Skip to content

Commit

Permalink
[dhcp_relay] Skip dhcp_relay test via feature status rather than topo
Browse files Browse the repository at this point in the history
  • Loading branch information
yaqiangz committed Oct 11, 2024
1 parent ffbf8b5 commit 81f1183
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions tests/dhcp_relay/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,17 @@ def pytest_addoption(parser):


@pytest.fixture(scope="module", autouse=True)
def skip_dhcp_relay_tests(tbinfo):
"""
Skip dhcp relay tests on certain testbed types
Args:
tbinfo(fixture): testbed related info fixture
Yields:
None
"""
if 'backend' in tbinfo['topo']['name']:
pytest.skip("Skipping dhcp relay tests. Unsupported topology {}".format(tbinfo['topo']['name']))


@pytest.fixture(scope="module", autouse=True)
def check_dhcp_server_enabled(duthost):
def check_dhcp_feature_status(duthost):
feature_status_output = duthost.show_and_parse("show feature status")
dhcp_relay_enabled = False
for feature in feature_status_output:
if feature["feature"] == "dhcp_server" and feature["state"] == "enabled":
pytest.skip("DHCPv4 relay is not supported when dhcp_server is enabled")
if feature["feature"] == "dhcp_relay" and feature["state"] == "enabled":
dhcp_relay_enabled = True

if not dhcp_relay_enabled:
pytest.skip("dhcp_relay is not enabled")


@pytest.fixture(scope="module")
Expand Down

0 comments on commit 81f1183

Please sign in to comment.