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

[action] [PR:16197] feat: add one_dut fixture to only use one dut #16211

Merged
merged 1 commit into from
Jan 2, 2025
Merged
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
22 changes: 21 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1498,7 +1498,7 @@ def generate_dut_backend_asics(request, duts_selected):
return dut_asic_list


def generate_priority_lists(request, prio_scope, with_completeness_level=False):
def generate_priority_lists(request, prio_scope, with_completeness_level=False, one_dut_only=False):
empty = []

tbname = request.config.getoption("--testbed")
Expand All @@ -1524,6 +1524,9 @@ def generate_priority_lists(request, prio_scope, with_completeness_level=False):
for p in priorities:
ret.append('{}|{}'.format(dut, p))

if one_dut_only:
break

if with_completeness_level:
completeness_level = get_completeness_level_metadata(request)
# if completeness_level in ["debug", "basic", "confident"],
Expand All @@ -1540,6 +1543,9 @@ def generate_priority_lists(request, prio_scope, with_completeness_level=False):
p = random.choice(priorities)
ret.append('{}|{}'.format(dut, p))

if one_dut_only:
break

return ret if ret else empty


Expand Down Expand Up @@ -1733,14 +1739,28 @@ def format_portautoneg_test_id(param):
metafunc.parametrize("enum_dut_all_prio", generate_priority_lists(metafunc, 'all'))
if 'enum_dut_lossless_prio' in metafunc.fixturenames:
metafunc.parametrize("enum_dut_lossless_prio", generate_priority_lists(metafunc, 'lossless'))
if 'enum_one_dut_lossless_prio' in metafunc.fixturenames:
metafunc.parametrize("enum_one_dut_lossless_prio",
generate_priority_lists(metafunc, 'lossless', one_dut_only=True))
if 'enum_dut_lossless_prio_with_completeness_level' in metafunc.fixturenames:
metafunc.parametrize("enum_dut_lossless_prio_with_completeness_level",
generate_priority_lists(metafunc, 'lossless', with_completeness_level=True))
if 'enum_one_dut_lossless_prio_with_completeness_level' in metafunc.fixturenames:
metafunc.parametrize("enum_one_dut_lossless_prio_with_completeness_level",
generate_priority_lists(metafunc, 'lossless', with_completeness_level=True,
one_dut_only=True))
if 'enum_dut_lossy_prio' in metafunc.fixturenames:
metafunc.parametrize("enum_dut_lossy_prio", generate_priority_lists(metafunc, 'lossy'))
if 'enum_one_dut_lossy_prio' in metafunc.fixturenames:
metafunc.parametrize("enum_one_dut_lossy_prio", generate_priority_lists(metafunc, 'lossy',
one_dut_only=True))
if 'enum_dut_lossy_prio_with_completeness_level' in metafunc.fixturenames:
metafunc.parametrize("enum_dut_lossy_prio_with_completeness_level",
generate_priority_lists(metafunc, 'lossy', with_completeness_level=True))
if 'enum_one_dut_lossy_prio_with_completeness_level' in metafunc.fixturenames:
metafunc.parametrize("enum_one_dut_lossy_prio_with_completeness_level",
generate_priority_lists(metafunc, 'lossy', with_completeness_level=True,
one_dut_only=True))
if 'enum_pfc_pause_delay_test_params' in metafunc.fixturenames:
metafunc.parametrize("enum_pfc_pause_delay_test_params", pfc_pause_delay_test_params(metafunc))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_pfc_pause_single_lossless_prio(snappi_api, # noqa:
conn_graph_facts, # noqa: F811
fanout_graph_facts_multidut, # noqa: F811
duthosts,
enum_dut_lossless_prio,
enum_one_dut_lossless_prio,
prio_dscp_map, # noqa: F811
lossless_prio_list, # noqa: F811
all_prio_list, # noqa: F811
Expand Down Expand Up @@ -58,7 +58,7 @@ def test_pfc_pause_single_lossless_prio(snappi_api, # noqa:

testbed_config, port_config_list, snappi_ports = setup_ports_and_dut

_, lossless_prio = enum_dut_lossless_prio.split('|')
_, lossless_prio = enum_one_dut_lossless_prio.split('|')
lossless_prio = int(lossless_prio)
pause_prio_list = [lossless_prio]
test_prio_list = [lossless_prio]
Expand Down Expand Up @@ -142,7 +142,7 @@ def test_pfc_pause_single_lossless_prio_reboot(snappi_api, # n
fanout_graph_facts_multidut, # noqa: F811
duthosts,
localhost,
enum_dut_lossless_prio_with_completeness_level, # noqa: F811
enum_one_dut_lossless_prio_with_completeness_level, # noqa: F811
prio_dscp_map, # noqa: F811
lossless_prio_list, # noqa: F811
all_prio_list, # noqa: F811
Expand Down Expand Up @@ -171,7 +171,7 @@ def test_pfc_pause_single_lossless_prio_reboot(snappi_api, # n
"""
testbed_config, port_config_list, snappi_ports = setup_ports_and_dut

_, lossless_prio = enum_dut_lossless_prio_with_completeness_level.split('|')
_, lossless_prio = enum_one_dut_lossless_prio_with_completeness_level.split('|')
lossless_prio = int(lossless_prio)
pause_prio_list = [lossless_prio]
test_prio_list = [lossless_prio]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_pfc_pause_single_lossy_prio(snappi_api, # noqa: F811
conn_graph_facts, # noqa: F811
fanout_graph_facts_multidut, # noqa: F811
duthosts,
enum_dut_lossy_prio,
enum_one_dut_lossy_prio,
prio_dscp_map, # noqa: F811
lossy_prio_list, # noqa: F811
all_prio_list, # noqa: F811
Expand Down Expand Up @@ -57,7 +57,7 @@ def test_pfc_pause_single_lossy_prio(snappi_api, # noqa: F811
"""
testbed_config, port_config_list, snappi_ports = setup_ports_and_dut

_, lossy_prio = enum_dut_lossy_prio.split('|')
_, lossy_prio = enum_one_dut_lossy_prio.split('|')
lossy_prio = int(lossy_prio)
pause_prio_list = [lossy_prio]
test_prio_list = [lossy_prio]
Expand Down Expand Up @@ -150,7 +150,7 @@ def test_pfc_pause_single_lossy_prio_reboot(snappi_api, # noqa: F811
fanout_graph_facts_multidut, # noqa: F811
duthosts,
localhost,
enum_dut_lossy_prio_with_completeness_level,
enum_one_dut_lossy_prio_with_completeness_level,
prio_dscp_map, # noqa: F811
lossy_prio_list, # noqa: F811
all_prio_list, # noqa: F811
Expand Down Expand Up @@ -180,7 +180,7 @@ def test_pfc_pause_single_lossy_prio_reboot(snappi_api, # noqa: F811
"""
testbed_config, port_config_list, snappi_ports = setup_ports_and_dut

_, lossy_prio = enum_dut_lossy_prio_with_completeness_level.split('|')
_, lossy_prio = enum_one_dut_lossy_prio_with_completeness_level.split('|')
lossy_prio = int(lossy_prio)
pause_prio_list = [lossy_prio]
test_prio_list = [lossy_prio]
Expand Down
Loading