Skip to content

fixed PFC tests for Sonic fanouts#6640

Merged
neethajohn merged 1 commit intosonic-net:masterfrom
antonptashnik:fix-pfc-tests-on-sonic-fanout
Nov 1, 2022
Merged

fixed PFC tests for Sonic fanouts#6640
neethajohn merged 1 commit intosonic-net:masterfrom
antonptashnik:fix-pfc-tests-on-sonic-fanout

Conversation

@antonptashnik
Copy link
Contributor

Description of PR

Summary: fixed PFC tests for Sonic fanouts
Fixes # (issue)

PFC tests fail on Sonic fanout because it has Python 3 env but PFC gen script is written for Python 2.
Adapted PFC gen script to work both on Python 2 and 3.

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?

Support PFC tests on fanouts with Python 3

How did you do it?

How did you verify/test it?

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...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

tests/common/helpers/pfc_gen.py:9:1: F401 'os' imported but unused
tests/common/helpers/pfc_gen.py:14:1: F403 'from struct import ' used; unable to detect undefined names
tests/common/helpers/pfc_gen.py:14:1: F401 'struct.
' imported but unused
tests/common/helpers/pfc_gen.py:19:1: E302 expected 2 blank lines, found 1
tests/common/helpers/pfc_gen.py:24:46: E202 whitespace before ')'
tests/common/helpers/pfc_gen.py:27:11: E227 missing whitespace around bitwise or shift operator
tests/common/helpers/pfc_gen.py:30:5: E265 block comment should start with '# '
tests/common/helpers/pfc_gen.py:35:1: E302 expected 2 blank lines, found 1
tests/common/helpers/pfc_gen.py:38:121: E501 line too long (152 > 120 characters)
tests/common/helpers/pfc_gen.py:38:132: E231 missing whitespace after ','
tests/common/helpers/pfc_gen.py:39:121: E501 line too long (135 > 120 characters)
...
[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>

@neethajohn neethajohn merged commit fe106ce into sonic-net:master Nov 1, 2022
@antonptashnik antonptashnik deleted the fix-pfc-tests-on-sonic-fanout branch November 2, 2022 07:34
@rraghav-cisco
Copy link
Contributor

@antonptashnik , pls port this to 202205 as well. Thanks!

wangxin pushed a commit that referenced this pull request Mar 9, 2023
PFC tests fail on Sonic fanout because it has Python 3 env but PFC gen script is written for Python 2.
Adapted PFC gen script to work both on Python 2 and 3.
wangxin pushed a commit that referenced this pull request Mar 9, 2023
PFC tests fail on Sonic fanout because it has Python 3 env but PFC gen script is written for Python 2.
Adapted PFC gen script to work both on Python 2 and 3.
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