Skip to content

Commit

Permalink
fix keyerror of PR sonic-net#10382 (sonic-net#11722)
Browse files Browse the repository at this point in the history
What is the motivation for this PR?
PR sonic-net#10382 caused below two KeyError:

    @pytest.fixture(scope="function", autouse=False)
    def skip_pacific_dst_asic(self, dutConfig):
>       if dutConfig['dstDutAsic'] == "pac":
E       KeyError: 'dstDutAsic'
        if "wm_pg_shared_lossless" in pgProfile:
            pktsNumFillShared = qosConfig[pgProfile]["pkts_num_trig_pfc"]
        elif "wm_pg_shared_lossy" in pgProfile:
>           if dutConfig['dstDutAsic'] == "pac":
E           KeyError: 'dstDutAsic'
and remove duplicated code in PR sonic-net#11553 and PR sonic-net#10838, it will cause pre-commit failure

    @pytest.fixture(scope="function", autouse=False)
    def skip_longlink(self, dutQosConfig):
        portSpeedCableLength = dutQosConfig["portSpeedCableLength"]
        match = re.search("_([0-9]*)m", portSpeedCableLength)
        if match and int(match.group(1)) > 2000:
            pytest.skip(
                "This test is skipped for longlink.")
        yield
        return
How did you do it?
fix keyerror and remove duplicated code
  • Loading branch information
XuChen-MSFT authored and mssonicbld committed Feb 20, 2024
1 parent 4db0f2b commit 4808b21
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/qos/qos_sai_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2155,7 +2155,7 @@ def _skip_watermark_multi_DUT(

@pytest.fixture(scope="function", autouse=False)
def skip_pacific_dst_asic(self, dutConfig):
if dutConfig['dstDutAsic'] == "pac":
if dutConfig.get('dstDutAsic', 'UnknownDstDutAsic') == "pac":
pytest.skip(
"This test is skipped since egress asic is cisco-8000 Q100.")
yield
Expand Down
2 changes: 1 addition & 1 deletion tests/qos/test_qos_sai.py
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,7 @@ def testQosSaiPgSharedWatermark(
if "wm_pg_shared_lossless" in pgProfile:
pktsNumFillShared = qosConfig[pgProfile]["pkts_num_trig_pfc"]
elif "wm_pg_shared_lossy" in pgProfile:
if dutConfig['dstDutAsic'] == "pac":
if dutConfig.get('dstDutAsic', 'UnknownDstDutAsic') == "pac":
pytest.skip(
"PGSharedWatermark: Lossy test is not applicable in "
"cisco-8000 Q100 platform.")
Expand Down

0 comments on commit 4808b21

Please sign in to comment.