Skip to content

[QoS] qos test fixes#6786

Merged
ZhaohuiS merged 1 commit intosonic-net:masterfrom
AntonHryshchuk:qos_python3_fixes
Nov 10, 2022
Merged

[QoS] qos test fixes#6786
ZhaohuiS merged 1 commit intosonic-net:masterfrom
AntonHryshchuk:qos_python3_fixes

Conversation

@AntonHryshchuk
Copy link
Contributor

@AntonHryshchuk AntonHryshchuk commented Nov 9, 2022

Signed-off-by: Anton antonh@nvidia.com

Description of PR

Summary:

  1. Fix after moving the test to python3.
    Fix for [QoS] some sai qos test failed after moving to python3  #6787
    The number of packets to send is the float value:
"  File \"saitests/py3/sai_qos_tests.py\", line 2552, in runTest",
"  File \"/root/env-python3/lib/python3.7/site-packages/ptf/testutils.py\", line 3202, in send_packet",
"    for n in range(count):", "TypeError: 'float' object cannot be interpreted as an integer"

python2: 3/2=1
python3: 3/2=1.5
"/" in python2 == "//" in python3
Changed in places when calculating the number of packets from "/" to "//"

  1. Fix ignore in test_mark_conditions.yaml:
    the test testQosSaiHeadroomPoolWatermark[r-tigon-04-None] not matched by condition testQosSaiHeadroomPoolWatermark[None]
    Removed "[None]"

  2. Fixed error in the test testQosSaiPgHeadroomWatermark[r-tigon-04-None]
    print(\"lower bound: %d, actual value: %d, upper bound: %d\" % (expected_wm - margin) * cell_size * cell_occupancy, pg_headroom_wm_res[pg], ((expected_wm + margin) * cell_size * cell_occupancy), file=sys.stderr)", "TypeError: not enough arguments for format string"
    Added missing "()", which is required in printing more than one parameter

Type of change

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

Back port request

  • 201911
  • 202012
  • 202205

Approach

What is the motivation for this PR?

Stabilize the QoS tests

How did you do it?

fixed the relevant mistakes

How did you verify/test it?

Tests executed and passed

Any platform specific information?

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

Documentation

@azure-pipelines
Copy link

The pre-commit check detected issues in the files touched by this pull request.
The detected issues may be old or new. For new issues, please try to fix them.

For old issues, it is not mandatory to fix them because they were not caused by this change. It is unfair to blame
author of this pull request. But if you can take extra effort to fix the old issues as well, that would be great!

Detailed pre-commit check results:
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check yaml...............................................................Failed
- hook id: check-yaml
- exit code: 1

while constructing a mapping
in "tests/common/plugins/conditional_mark/tests_mark_conditions.yaml", line 775, column 3
found duplicate key "skip" with value "{}" (original value: "{}")
in "tests/common/plugins/conditional_mark/tests_mark_conditions.yaml", line 779, column 3

To suppress this check see:
http://yaml.readthedocs.io/en/latest/api.html#duplicate-keys

check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1
...
[truncated extra lines, please run pre-commit locally to view full check results]

To run the pre-commit checks locally, you can follow below steps:

  1. Ensure that default python is python3. In sonic-mgmt docker container, default python is python2. You can run
    the check by activating the python3 virtual environment in sonic-mgmt docker container or outside of sonic-mgmt
    docker container.
  2. Ensure that the pre-commit package is installed:
sudo pip install pre-commit
  1. Go to repository root folder
  2. Install the pre-commit hooks:
pre-commit install
  1. Use pre-commit to check staged file:
pre-commit
  1. Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>

Signed-off-by: Anton <antonh@nvidia.com>
@azure-pipelines
Copy link

The pre-commit check detected issues in the files touched by this pull request.
The detected issues may be old or new. For new issues, please try to fix them.

For old issues, it is not mandatory to fix them because they were not caused by this change. It is unfair to blame
author of this pull request. But if you can take extra effort to fix the old issues as well, that would be great!

Detailed pre-commit check results:
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check yaml...............................................................Passed
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

tests/saitests/py3/sai_qos_tests.py:8:1: F401 'ptf.dataplane' imported but unused
tests/saitests/py3/sai_qos_tests.py:21:1: F401 'switch.sai_port_list' imported but unused
tests/saitests/py3/sai_qos_tests.py:38:1: F401 'switch_sai_thrift.sai_headers.SAI_PORT_ATTR_PKT_TX_ENABLE' imported but unused
tests/saitests/py3/sai_qos_tests.py:208:10: E114 indentation is not a multiple of 4 (comment)
tests/saitests/py3/sai_qos_tests.py:208:10: E117 over-indented (comment)
tests/saitests/py3/sai_qos_tests.py:319:41: E127 continuation line over-indented for visual indent
tests/saitests/py3/sai_qos_tests.py:320:41: E127 continuation line over-indented for visual indent
tests/saitests/py3/sai_qos_tests.py:321:41: E127 continuation line over-indented for visual indent
tests/saitests/py3/sai_qos_tests.py:322:41: E127 continuation line over-indented for visual indent
tests/saitests/py3/sai_qos_tests.py:323:41: E127 continuation line over-indented for visual indent
tests/saitests/py3/sai_qos_tests.py:324:41: E127 continuation line over-indented for visual indent
...
[truncated extra lines, please run pre-commit locally to view full check results]

To run the pre-commit checks locally, you can follow below steps:

  1. Ensure that default python is python3. In sonic-mgmt docker container, default python is python2. You can run
    the check by activating the python3 virtual environment in sonic-mgmt docker container or outside of sonic-mgmt
    docker container.
  2. Ensure that the pre-commit package is installed:
sudo pip install pre-commit
  1. Go to repository root folder
  2. Install the pre-commit hooks:
pre-commit install
  1. Use pre-commit to check staged file:
pre-commit
  1. Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>

@liat-grozovik
Copy link
Collaborator

@ZhaohuiS please see this fix. Can you please check how tests passed on the original pr that as a result the test cannot pass?

Copy link
Contributor

@ZhaohuiS ZhaohuiS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ZhaohuiS ZhaohuiS merged commit a4eb0a2 into sonic-net:master Nov 10, 2022
@ZhaohuiS
Copy link
Contributor

@ZhaohuiS please see this fix. Can you please check how tests passed on the original pr that as a result the test cannot pass?

@liat-grozovik Just merged this PR. qos test cases kept failing internally for long time, the reason I submitted #6787 is saithrift(imported in ptf qos scripts) is built for python3, but related qos test cases are not transformed to python3. So, I did migration. But previous cases were kept failing, I don't have result to compare, I checked setup phase and it passed. I didn't verify each case result. I am thinking to fix setup part firstly to unblock test running and then if there is something new failure, let's fix them step by step.

@AntonHryshchuk AntonHryshchuk deleted the qos_python3_fixes branch November 16, 2022 08:45
wangxin pushed a commit that referenced this pull request Nov 23, 2022
Description of PR
Summary:

Fix after moving the test to python3.
Fix for [QoS] some sai qos test failed after moving to python3  #6787
The number of packets to send is the float value:
"  File \"saitests/py3/sai_qos_tests.py\", line 2552, in runTest",
"  File \"/root/env-python3/lib/python3.7/site-packages/ptf/testutils.py\", line 3202, in send_packet",
"    for n in range(count):", "TypeError: 'float' object cannot be interpreted as an integer"
python2: 3/2=1
python3: 3/2=1.5
"/" in python2 == "//" in python3
Changed in places when calculating the number of packets from "/" to "//"

Fix ignore in test_mark_conditions.yaml:
the test testQosSaiHeadroomPoolWatermark[r-tigon-04-None] not matched by condition testQosSaiHeadroomPoolWatermark[None]
Removed "[None]"

Fixed error in the test testQosSaiPgHeadroomWatermark[r-tigon-04-None]
print(\"lower bound: %d, actual value: %d, upper bound: %d\" % (expected_wm - margin) * cell_size * cell_occupancy, pg_headroom_wm_res[pg], ((expected_wm + margin) * cell_size * cell_occupancy), file=sys.stderr)", "TypeError: not enough arguments for format string"
Added missing "()", which is required in printing more than one parameter
Signed-off-by: Anton <antonh@nvidia.com>
congh-nvidia added a commit to congh-nvidia/sonic-mgmt that referenced this pull request Dec 5, 2022
There is one line missing in sonic-net#6786, fix it.
liat-grozovik pushed a commit that referenced this pull request Dec 6, 2022
In PR #6786, there was one line missed(line 2618) Need to use '//' instead of '/' for the floor division in python3.

- What is the motivation for this PR?
Fix a bug in qos sai test.

- How did you do it?
use '//' instead of '/' for the floor division in python3

- How did you verify/test it?
Verified by automation, test passed.
wangxin pushed a commit that referenced this pull request Dec 7, 2022
In PR #6786, there was one line missed(line 2618) Need to use '//' instead of '/' for the floor division in python3.

- What is the motivation for this PR?
Fix a bug in qos sai test.

- How did you do it?
use '//' instead of '/' for the floor division in python3

- How did you verify/test it?
Verified by automation, test passed.
@antonptashnik antonptashnik mentioned this pull request Dec 21, 2022
6 tasks
bingwang-ms pushed a commit to bingwang-ms/sonic-mgmt that referenced this pull request Jul 27, 2023
…ic-mgmt into internal-202205

Fix merge conflicts.

- Fix verify_no_packet_any call in fib_test (sonic-net#6461)
- Fix the test case test_TSA failure when check the routes on the eos host (sonic-net#6483)
- Use conditional mark to skip testcase instead of required_mocked_dualtor (sonic-net#6766)
- [tagged_arp] fix issue 'fixture ports_list not found' (sonic-net#6773)
- [QoS] fixes after moving to python3 (sonic-net#6786)
- update parse funciton for image url (sonic-net#6848)
- Fix typo in get_queue_counter (sonic-net#6852)
- Revert "Fix loganalyzer.py UnicodeDecodeError (sonic-net#6524)" (sonic-net#6858)
- Enhancing core_dump_and_config_check to be multi-asic aware (sonic-net#6527)
- Adding support for calculating balancing in multi-lc/multi-asic case (Test_fib.py) (sonic-net#6391)
- Support different RC in case of pre or post sanity check failed (sonic-net#6860)
- Update getbuild.py to support pass an empty access_token
- [202205] Fixing auto_techsupport (sonic-net#6882)
- Merge branch 'azure-202205' into dev/yaqiangzhu/202205_manually_merge
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.

5 participants