Skip to content

Fix IndexError in test_no_pfc#12263

Merged
bingwang-ms merged 1 commit intosonic-net:masterfrom
bingwang-ms:fix_key_error_test_no_pfc
Apr 2, 2024
Merged

Fix IndexError in test_no_pfc#12263
bingwang-ms merged 1 commit intosonic-net:masterfrom
bingwang-ms:fix_key_error_test_no_pfc

Conversation

@bingwang-ms
Copy link
Collaborator

Description of PR

The PR is to fix IndexError in test case test_no_pfc.
The error is because the fixture lossless_prio_dscp_map always selects the first port in PORT_QOS_MAP table as the testing port, and selects the first profile in DSCP_TO_TC_MAP to get the DSCP to TC map. So on some particular topo, we saw the IndexError because the selected profile is not applied to the testing port.

>           traffic_params = {'dscp': dscp[0], 'dscp_bg': dscp_bg}
E           IndexError: list index out of range

This PR fixed the issue by checking the lossless priority and lossless_prio_dscp_map as well. The test case will be skipped if the extra lossless queue is not enabled on this port or the map lossless_prio_dscp_map for a particular priority is empty.

Summary:
Fixes IndexError in test case test_no_pfc.

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Back port request

  • 201911
  • 202012
  • 202205
  • 202305
  • 202311

Approach

What is the motivation for this PR?

This PR is to address IndexError in test_no_pfc.

How did you do it?

This PR fixed the issue by checking the lossless priority and lossless_prio_dscp_map as well. The test case will be skipped if the extra lossless queue is not enabled on this port or the map lossless_prio_dscp_map for a particular priority is empty.

How did you verify/test it?

Verified on a dualtor testbed where I saw the new failure. Test can pass now.

collected 8 items                                                                                                                                                                                     

qos/test_pfc_pause.py::test_no_pfc[svcstr-7050-acs-3|2] SKIPPED (lossless prio 2 not enabled on testing port)                                                                                   [ 12%]
qos/test_pfc_pause.py::test_no_pfc[svcstr-7050-acs-3|3]  ^HPASSED                                                                                                                                  [ 25%]
qos/test_pfc_pause.py::test_no_pfc[svcstr-7050-acs-3|4] PASSED                                                                                                                                  [ 37%]
qos/test_pfc_pause.py::test_no_pfc[svcstr-7050-acs-3|6] SKIPPED (lossless prio 6 not enabled on testing port)                                                                                   [ 50%]
qos/test_pfc_pause.py::test_no_pfc[svcstr-7050-acs-4|2] SKIPPED (lossless prio 2 not enabled on testing port)                                                                                   [ 62%]
qos/test_pfc_pause.py::test_no_pfc[svcstr-7050-acs-4|3]  ^HPASSED                                                                                                                                  [ 75%]
qos/test_pfc_pause.py::test_no_pfc[svcstr-7050-acs-4|4] PASSED                                                                                                                                  [ 87%]
qos/test_pfc_pause.py::test_no_pfc[svcstr-7050-acs-4|6] SKIPPED (lossless prio 6 not enabled on testing port)                                                                                   [100%]

Any platform specific information?

No.

Supported testbed topology if it's a new test case?

Not a new test case.

Documentation

@bingwang-ms
Copy link
Collaborator Author

MSFT ADO: 27317506

@bingwang-ms bingwang-ms merged commit c8bb8e8 into sonic-net:master Apr 2, 2024
@bingwang-ms
Copy link
Collaborator Author

@StormLiangMS Please help approve the cherry-pick. Thanks!

@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202305: #12295

@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202311: #12296

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants