sonic-mgmt
sonic-mgmt copied to clipboard
[Snappi] Added multi dut pfcwd basic test case
Description of PR
- Test to determine the PFC watchdog behavior when it detects the storm and after it is restored.
Summary: Fixes # (issue)
Type of change
- [ ] Bug fix
- [ ] Testbed and Framework(new/improvement)
- [x ] Test case(new/improvement)
Output
`AzDevOps@6105354dad99:~/sonic-mgmt/tests$ py.test --inventory ../ansible/snappi-sonic --host-pattern sonic-s6100-dut --testbed vms-snappi-sonic --testbed_file ../ansible/testbed.csv --show-capture=stdout --log-cli-level info --showlocals -ra --allow_recover --skip_sanity --disable_loganalyzer snappi_tests/dinesh_pfcwd/test_multidut_pfcwd_basic_with_snappi.py
/usr/local/lib/python2.7/dist-packages/ansible/parsing/vault/init.py:44: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
from cryptography.exceptions import InvalidSignature
============================================================================================================ test session starts =============================================================================================================
platform linux2 -- Python 2.7.18, pytest-4.6.11, py-1.11.0, pluggy-0.13.1
ansible: 2.8.20
rootdir: /var/AzDevOps/sonic-mgmt/tests, inifile: pytest.ini
plugins: allure-pytest-2.8.22, celery-4.4.7, ansible-2.2.4, forked-1.3.0, html-1.22.1, metadata-1.11.0, repeat-0.9.1, xdist-1.28.0
collecting 2 items
------------------------------------------------------------------------------------------------------------ live log collection -------------------------------------------------------------------------------------------------------------
22:27:12 init.pytest_collection_modifyitems L0582 INFO | Available basic facts that can be used in conditional skip:
{
"topo_type": "ptf",
"testbed": "vms-snappi-sonic",
"topo_name": "ptf64"
}
--------------------------------------------------------------------------------------------------------------- live log setup ---------------------------------------------------------------------------------------------------------------
22:27:12 init.set_default L0054 INFO | Completeness level not set during test execution. Setting to default level: CompletenessLevel.basic
22:27:12 init.check_test_completeness L0152 INFO | Test has no defined levels. Continue without test completeness checks
22:27:19 ptfhost_utils.run_icmp_responder_session L0239 INFO | Skip running icmp_responder at session level, it is only for dualtor testbed with active-active mux ports.
22:27:19 conftest.creds_on_dut L0704 INFO | dut sonic-s6100-dut belongs to groups [u'snappi-sonic', u'sonic', u'sonic_dell64_40', 'fanout']
22:27:19 conftest.creds_on_dut L0728 INFO | skip empty var file ../ansible/group_vars/all/corefile_uploader.yml
22:27:19 conftest.creds_on_dut L0728 INFO | skip empty var file ../ansible/group_vars/all/env.yml
22:27:19 conftest.nbrhosts L0521 INFO | No VMs exist for this topology: ptf64
22:27:19 conftest.core_dump_and_config_check L2032 INFO | Collecting core dumps before test on sonic-s6100-dut
22:27:20 conftest.core_dump_and_config_check L2041 INFO | Collecting running config before test on sonic-s6100-dut
22:27:24 init.sanity_check L0125 INFO | Skip sanity check according to command line argument
22:27:24 conftest.generate_params_dut_hostname L1108 INFO | Using DUTs ['sonic-s6100-dut'] in testbed 'vms-snappi-sonic'
22:27:24 conftest.rand_one_dut_hostname L0378 INFO | Randomly select dut sonic-s6100-dut for testing
22:27:24 init._fixture_generator_decorator L0081 INFO | -------------------- fixture enable_packet_aging_after_test setup starts --------------------
22:27:24 init._fixture_generator_decorator L0085 INFO | -------------------- fixture enable_packet_aging_after_test setup ends --------------------
22:27:24 init._fixture_generator_decorator L0081 INFO | -------------------- fixture rand_lossless_prio setup starts --------------------
22:27:24 init._fixture_generator_decorator L0085 INFO | -------------------- fixture rand_lossless_prio setup ends --------------------
22:27:24 init._fixture_generator_decorator L0081 INFO | -------------------- fixture rand_lossy_prio setup starts --------------------
22:27:24 init._fixture_generator_decorator L0085 INFO | -------------------- fixture rand_lossy_prio setup ends --------------------
22:27:24 init._fixture_generator_decorator L0081 INFO | -------------------- fixture start_pfcwd_after_test setup starts --------------------
22:27:24 init._fixture_generator_decorator L0085 INFO | -------------------- fixture start_pfcwd_after_test setup ends --------------------
22:27:24 init._fixture_func_decorator L0069 INFO | -------------------- fixture snappi_api_serv_ip setup starts --------------------
22:27:24 init._fixture_func_decorator L0076 INFO | -------------------- fixture snappi_api_serv_ip setup ends --------------------
22:27:24 init._fixture_func_decorator L0069 INFO | -------------------- fixture snappi_api_serv_port setup starts --------------------
22:27:24 init._fixture_func_decorator L0076 INFO | -------------------- fixture snappi_api_serv_port setup ends --------------------
22:27:24 init._fixture_generator_decorator L0081 INFO | -------------------- fixture snappi_api setup starts --------------------
22:27:25 init._fixture_generator_decorator L0085 INFO | -------------------- fixture snappi_api setup ends --------------------
22:27:25 init._fixture_func_decorator L0069 INFO | -------------------- fixture prio_dscp_map setup starts --------------------
22:27:26 init._fixture_func_decorator L0076 INFO | -------------------- fixture prio_dscp_map setup ends --------------------
22:27:26 init.loganalyzer L0045 INFO | Log analyzer is disabled
22:27:26 init._fixture_func_decorator L0069 INFO | -------------------- fixture get_multidut_snappi_ports setup starts --------------------
22:27:26 init._fixture_func_decorator L0076 INFO | -------------------- fixture get_multidut_snappi_ports setup ends --------------------
--------------------------------------------------------------------------------------------------------------- live log call ----------------------------------------------------------------------------------------------------------------
22:27:26 snappi_fixtures.__intf_config_multidut L0789 INFO | Configuring Dut: sonic-s6100-dut with port Ethernet0 with IP 20.1.1.1/8
22:27:28 snappi_fixtures.__intf_config_multidut L0789 INFO | Configuring Dut: sonic-s6100-dut with port Ethernet4 with IP 21.1.1.1/8
22:27:38 connection._warn L0246 WARNING| Verification of certificates is disabled
22:27:38 connection._info L0243 INFO | Determining the platform and rest_port using the 10.36.78.135 address...
22:27:38 connection._warn L0246 WARNING| Unable to connect to http://10.36.78.135:443.
22:27:38 connection._info L0243 INFO | Connection established to https://10.36.78.135:443 on linux
22:27:52 connection._info L0243 INFO | Using IxNetwork api server version 9.30.2212.7
22:27:52 connection._info L0243 INFO | User info IxNetwork/ixnetworkweb/admin-159-28511
22:27:52 snappi_api.info L1132 INFO | snappi-0.9.1
22:27:52 snappi_api.info L1132 INFO | snappi_ixnetwork-0.9.1
22:27:52 snappi_api.info L1132 INFO | ixnetwork_restpy-1.0.64
22:27:53 snappi_api.info L1132 INFO | Config validation 0.010s
22:27:55 snappi_api.info L1132 INFO | Ports configuration 1.733s
22:27:55 snappi_api.info L1132 INFO | Captures configuration 0.167s
22:27:58 snappi_api.info L1132 INFO | Add location hosts [10.36.78.53] 2.425s
22:28:02 snappi_api.info L1132 INFO | Location hosts ready [10.36.78.53] 4.172s
22:28:03 snappi_api.info L1132 INFO | Speed conversion is not require for (port.name, speed) : [('Port 0', u'novusHundredGigNonFanOut'), ('Port 1', u'novusHundredGigNonFanOut')]
22:28:03 snappi_api.info L1132 INFO | Aggregation mode speed change 0.437s
22:28:07 snappi_api.info L1132 INFO | Location preemption [10.36.78.53;6;2, 10.36.78.53;6;1] 0.115s
22:28:30 snappi_api.info L1132 INFO | Location connect [Port 0, Port 1] 23.016s
22:28:31 snappi_api.warning L1138 WARNING| Port 0 connectedLinkDown
22:28:31 snappi_api.info L1132 INFO | Location state check [Port 0, Port 1] 0.268s
22:28:31 snappi_api.info L1132 INFO | Location configuration 35.273s
22:28:43 snappi_api.info L1132 INFO | Layer1 configuration 12.237s
22:28:43 snappi_api.info L1132 INFO | Lag Configuration 0.089s
22:28:43 snappi_api.info L1132 INFO | Convert device config : 0.258s
22:28:43 snappi_api.info L1132 INFO | Create IxNetwork device config : 0.000s
22:28:44 snappi_api.info L1132 INFO | Push IxNetwork device config : 0.607s
22:28:44 snappi_api.info L1132 INFO | Devices configuration 0.944s
22:28:47 snappi_api.info L1132 INFO | Flows configuration 3.229s
22:28:54 snappi_api.info L1132 INFO | Start interfaces 6.661s
22:28:54 snappi_api.info L1132 INFO | IxNet - The Traffic Item was modified. Please perform a Traffic Generate to update the associated traffic Flow Groups
22:28:54 pfcwd_multidut_basic_helper.__run_traffi L0273 INFO | Wait for Arp to Resolve ...
22:28:56 pfcwd_multidut_basic_helper.__run_traffi L0276 INFO | Starting transmit on all flows ...
22:28:59 snappi_api.info L1132 INFO | Flows generate/apply 3.034s
22:29:11 snappi_api.info L1132 INFO | Flows clear statistics 12.071s
22:29:11 snappi_api.info L1132 INFO | Captures start 0.000s
22:29:14 snappi_api.info L1132 INFO | Flows start 2.602s
22:29:25 pfcwd_multidut_basic_helper.__run_traffi L0308 INFO | Stop transmit on all flows ...
22:29:26 pfcwd_multidut_basic_helper.__verify_res L0338 INFO | Flow Name : Data Flow 1 Prio 3 , Tx Frames : 2394636, Rx Frames : 1001
22:29:26 pfcwd_multidut_basic_helper.__verify_res L0338 INFO | Flow Name : Data Flow 2 Prio 3 , Tx Frames : 2394636, Rx Frames : 2002
22:29:26 pfcwd_multidut_basic_helper.__verify_res L0338 INFO | Flow Name : Pause Storm , Tx Frames : 5960, Rx Frames : 0
22:29:26 pfcwd_multidut_basic_helper.__verify_res L0348 INFO | Flow Name : Data Flow 1, Loss Rate : 0.999581982397
22:29:26 pfcwd_multidut_basic_helper.__verify_res L0348 INFO | Flow Name : Data Flow 2, Loss Rate : 0.999163964795
22:29:26 snappi_fixtures.cleanup_config L0942 INFO | Removing Configuration on Dut: sonic-s6100-dut with port Ethernet0 with ip :20.1.1.1/8
22:29:28 snappi_fixtures.cleanup_config L0942 INFO | Removing Configuration on Dut: sonic-s6100-dut with port Ethernet4 with ip :21.1.1.1/8
PASSED [ 50%]
snappi_tests/dinesh_pfcwd/test_multidut_pfcwd_basic_with_snappi.py::test_pfcwd_basic_single_lossless_prio[sonic-s6100-dut|4-linecard_configuration_set0-non_chassis_single_line_card-True]
--------------------------------------------------------------------------------------------------------------- live log setup ---------------------------------------------------------------------------------------------------------------
22:29:29 init.set_default L0054 INFO | Completeness level not set during test execution. Setting to default level: CompletenessLevel.basic
22:29:29 init.check_test_completeness L0152 INFO | Test has no defined levels. Continue without test completeness checks
22:29:29 init.loganalyzer L0045 INFO | Log analyzer is disabled
22:29:29 init._fixture_func_decorator L0069 INFO | -------------------- fixture get_multidut_snappi_ports setup starts --------------------
22:29:29 init._fixture_func_decorator L0076 INFO | -------------------- fixture get_multidut_snappi_ports setup ends --------------------
--------------------------------------------------------------------------------------------------------------- live log call ----------------------------------------------------------------------------------------------------------------
22:29:29 snappi_fixtures.__intf_config_multidut L0789 INFO | Configuring Dut: sonic-s6100-dut with port Ethernet4 with IP 20.1.1.1/8
22:29:31 snappi_fixtures.__intf_config_multidut L0789 INFO | Configuring Dut: sonic-s6100-dut with port Ethernet0 with IP 21.1.1.1/8
22:29:41 snappi_api.info L1132 INFO | Config validation 0.008s
22:29:42 snappi_api.info L1132 INFO | Ports configuration 0.260s
22:29:42 snappi_api.info L1132 INFO | Captures configuration 0.167s
22:29:49 snappi_api.info L1132 INFO | Location hosts ready [10.36.78.53] 2.088s
22:29:49 snappi_api.info L1132 INFO | Speed change not require due to redundant Layer1 config
22:29:49 snappi_api.info L1132 INFO | Aggregation mode speed change 0.012s
22:29:53 snappi_api.info L1132 INFO | Location preemption [10.36.78.53;6;2, 10.36.78.53;6;1] 0.114s
22:30:19 snappi_api.info L1132 INFO | Location connect [Port 0, Port 1] 25.139s
22:30:19 snappi_api.info L1132 INFO | Location state check [Port 0, Port 1] 0.248s
22:30:19 snappi_api.info L1132 INFO | Location configuration 36.358s
22:30:30 snappi_api.info L1132 INFO | Layer1 configuration 11.505s
22:30:30 snappi_api.info L1132 INFO | Lag Configuration 0.080s
22:30:31 snappi_api.info L1132 INFO | Convert device config : 0.515s
22:30:31 snappi_api.info L1132 INFO | Create IxNetwork device config : 0.000s
22:30:31 snappi_api.info L1132 INFO | Push IxNetwork device config : 0.238s
22:30:31 snappi_api.info L1132 INFO | Devices configuration 0.833s
22:30:34 snappi_api.info L1132 INFO | Flows configuration 2.985s
22:30:43 snappi_api.info L1132 INFO | Start interfaces 8.546s
22:30:43 snappi_api.info L1132 INFO | IxNet - The Traffic Item was modified. Please perform a Traffic Generate to update the associated traffic Flow Groups
22:30:43 pfcwd_multidut_basic_helper.__run_traffi L0273 INFO | Wait for Arp to Resolve ...
22:30:45 pfcwd_multidut_basic_helper.__run_traffi L0276 INFO | Starting transmit on all flows ...
22:30:47 snappi_api.info L1132 INFO | Flows generate/apply 2.169s
22:30:58 snappi_api.info L1132 INFO | Flows clear statistics 10.481s
22:30:58 snappi_api.info L1132 INFO | Captures start 0.000s
22:31:02 snappi_api.info L1132 INFO | Flows start 3.600s
22:31:10 pfcwd_multidut_basic_helper.__run_traffi L0308 INFO | Stop transmit on all flows ...
22:31:11 pfcwd_multidut_basic_helper.__verify_res L0338 INFO | Flow Name : Pause Storm , Tx Frames : 5960, Rx Frames : 0
22:31:11 pfcwd_multidut_basic_helper.__verify_res L0338 INFO | Flow Name : Data Flow 2 Prio 4 , Tx Frames : 2394636, Rx Frames : 0
22:31:11 pfcwd_multidut_basic_helper.__verify_res L0338 INFO | Flow Name : Data Flow 1 Prio 4 , Tx Frames : 2394636, Rx Frames : 0
22:31:11 pfcwd_multidut_basic_helper.__verify_res L0348 INFO | Flow Name : Data Flow 1, Loss Rate : 1.0
22:31:11 pfcwd_multidut_basic_helper.__verify_res L0348 INFO | Flow Name : Data Flow 2, Loss Rate : 1.0
22:31:11 snappi_fixtures.cleanup_config L0942 INFO | Removing Configuration on Dut: sonic-s6100-dut with port Ethernet4 with ip :20.1.1.1/8
22:31:12 snappi_fixtures.cleanup_config L0942 INFO | Removing Configuration on Dut: sonic-s6100-dut with port Ethernet0 with ip :21.1.1.1/8
PASSED [100%]
------------------------------------------------------------------------------------------------------------- live log teardown --------------------------------------------------------------------------------------------------------------
22:31:14 init._fixture_generator_decorator L0093 INFO | -------------------- fixture snappi_api teardown starts --------------------
22:31:23 init._fixture_generator_decorator L0102 INFO | -------------------- fixture snappi_api teardown ends --------------------
22:31:23 init._fixture_generator_decorator L0093 INFO | -------------------- fixture start_pfcwd_after_test teardown starts --------------------
22:31:24 init._fixture_generator_decorator L0102 INFO | -------------------- fixture start_pfcwd_after_test teardown ends --------------------
22:31:24 init._fixture_generator_decorator L0093 INFO | -------------------- fixture rand_lossy_prio teardown starts --------------------
22:31:24 init._fixture_generator_decorator L0102 INFO | -------------------- fixture rand_lossy_prio teardown ends --------------------
22:31:24 init._fixture_generator_decorator L0093 INFO | -------------------- fixture rand_lossless_prio teardown starts --------------------
22:31:24 init._fixture_generator_decorator L0102 INFO | -------------------- fixture rand_lossless_prio teardown ends --------------------
22:31:24 init._fixture_generator_decorator L0093 INFO | -------------------- fixture enable_packet_aging_after_test teardown starts --------------------
22:31:25 init._fixture_generator_decorator L0102 INFO | -------------------- fixture enable_packet_aging_after_test teardown ends --------------------
22:31:26 conftest.core_dump_and_config_check L2069 INFO | Collecting core dumps after test on sonic-s6100-dut
22:31:26 conftest.core_dump_and_config_check L2086 INFO | Collecting running config after test on sonic-s6100-dut
22:31:27 conftest.core_dump_and_config_check L2211 WARNING| Core dump or config check failed for test_multidut_pfcwd_basic_with_snappi.py, results: {"core_dump_check": {"new_core_dumps": {"sonic-s6100-dut": []}, "pass": true}, "config_db_check": {"cur_only_config": {"sonic-s6100-dut": {"null": {"INTERFACE": {"Ethernet12|20.1.1.1/8": {}, "Ethernet8": {}, "Ethernet0|2000:1::1/16": {}, "Ethernet8|21.1.1.1/8": {}, "Ethernet0": {}, "Ethernet4": {}, "Ethernet12|23.1.1.1/8": {}, "Ethernet12|2003:1::1/16": {}, "Ethernet8|2002:1::1/16": {}, "Ethernet8|22.1.1.1/8": {}, "Ethernet4|2001:1::1/16": {}, "Ethernet12": {}}, "PFC_WD": {"Ethernet0": {"action": "drop", "detection_time": "200", "restoration_time": "200"}, "GLOBAL": {"POLL_INTERVAL": "200"}, "Ethernet4": {"action": "drop", "detection_time": "200", "restoration_time": "200"}, "Ethernet12": {"action": "drop", "detection_time": "200", "restoration_time": "200"}, "Ethernet8": {"action": "drop", "detection_time": "200", "restoration_time": "200"}}}}}, "inconsistent_config": {"sonic-s6100-dut": {"null": {}}}, "pre_only_config": {"sonic-s6100-dut": {"null": {"VLAN_MEMBER": {"Vlan2|Ethernet8": {"tagging_mode": "untagged"}, "Vlan2|Ethernet0": {"tagging_mode": "untagged"}, "Vlan2|Ethernet12": {"tagging_mode": "untagged"}, "Vlan2|Ethernet4": {"tagging_mode": "untagged"}}}}}, "pass": false}}
============================================================================================================== warnings summary ============================================================================================================== /usr/local/lib/python2.7/dist-packages/_pytest/config/init.py:545 /usr/local/lib/python2.7/dist-packages/_pytest/config/init.py:545: PytestAssertRewriteWarning: Module already imported so cannot be rewritten: tests.common.plugins.loganalyzer self.import_plugin(import_spec)
/usr/local/lib/python2.7/dist-packages/_pytest/config/init.py:545 /usr/local/lib/python2.7/dist-packages/_pytest/config/init.py:545: PytestAssertRewriteWarning: Module already imported so cannot be rewritten: tests.common.plugins.sanity_check self.import_plugin(import_spec)
/usr/local/lib/python2.7/dist-packages/_pytest/config/init.py:545 /usr/local/lib/python2.7/dist-packages/_pytest/config/init.py:545: PytestAssertRewriteWarning: Module already imported so cannot be rewritten: tests.common.dualtor self.import_plugin(import_spec)
snappi_tests/dinesh_pfcwd/test_multidut_pfcwd_basic_with_snappi.py::test_pfcwd_basic_single_lossless_prio[sonic-s6100-dut|3-linecard_configuration_set0-non_chassis_single_line_card-True] /usr/local/lib/python2.7/dist-packages/pytest_ansible/module_dispatcher/v28.py:81: UserWarning: provided hosts list is empty, only localhost is available warnings.warn("provided hosts list is empty, only localhost is available")
-- Docs: https://docs.pytest.org/en/latest/warnings.html ----------------------------------------------------------------------------------------------------------- live log sessionfinish ----------------------------------------------------------------------------------------------------------- 22:31:27 init.pytest_terminal_summary L0064 INFO | Can not get Allure report URL. Please check logs ==================== 2 passed, 4 warnings in 255.64 seconds ==================== INFO:root:Can not get Allure report URL. Please check logs`
Back port request
- [ ] 201911
- [ ] 202012
- [ ] 202205
Approach
What is the motivation for this PR?
To verify the pfc watchdog behavior in multi-dut/multi-asic scenario.
How did you do it?
The existing RDMA cases for single dut has been modified to accommodate T2 topology, where separate fixtures has been added that takes into account the chassis type and asic choice as user input, so that the script supports both T1 and T2 topology
How did you verify/test it?
Tested against voq chassis with SONiC installed in it
Any platform specific information?
Tested against J2C+
Supported testbed topology if it's a new test case?
T2, T1 & T0
Documentation
https://github.com/sonic-net/sonic-mgmt/blob/master/docs/testplan/pfcwd/PFCWD_BASIC.md
Testplan for pfcwd basic test case is same for both singledut and multidut https://github.com/sonic-net/sonic-mgmt/blob/master/docs/testplan/pfcwd/PFCWD_BASIC.md
The pre-commit check detected issues in the files touched by this pull request. The pre-commit check is a mandatory check, please fix detected issues.
Detailed pre-commit check results:
trim trailing whitespace.................................................Failed
- hook id: trailing-whitespace
- exit code: 1
- files were modified by this hook
Fixing tests/snappi_tests/multidut/pfcwd/files/pfcwd_multidut_basic_helper.py
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/snappi_tests/multidut/pfcwd/files/pfcwd_multidut_basic_helper.py:41:5: F821 undefined name 'pytest_require'
flake8...............................................(no files to check)Skipped
check conditional mark sort..........................(no files to check)Skipped
To run the pre-commit checks locally, you can follow below steps:
- 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.
- Ensure that the
pre-commit
package is installed:
sudo pip install pre-commit
- Go to repository root folder
- Install the pre-commit hooks:
pre-commit install
- Use pre-commit to check staged file:
pre-commit
- Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>
The pre-commit check detected issues in the files touched by this pull request. The pre-commit check is a mandatory check, please fix detected issues.
Detailed pre-commit check results:
trim trailing whitespace.................................................Failed
- hook id: trailing-whitespace
- exit code: 1
- files were modified by this hook
Fixing tests/snappi_tests/multidut/pfcwd/files/pfcwd_multidut_basic_helper.py
fix end of files.........................................................Passed
check yaml...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Passed
flake8...............................................(no files to check)Skipped
check conditional mark sort..........................(no files to check)Skipped
To run the pre-commit checks locally, you can follow below steps:
- 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.
- Ensure that the
pre-commit
package is installed:
sudo pip install pre-commit
- Go to repository root folder
- Install the pre-commit hooks:
pre-commit install
- Use pre-commit to check staged file:
pre-commit
- Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>
The pre-commit check detected issues in the files touched by this pull request. The pre-commit check is a mandatory check, please fix detected issues.
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/snappi_tests/multidut/pfcwd/files/pfcwd_multidut_basic_helper.py:73:121: E501 line too long (123 > 120 characters)
flake8...............................................(no files to check)Skipped
check conditional mark sort..........................(no files to check)Skipped
To run the pre-commit checks locally, you can follow below steps:
- 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.
- Ensure that the
pre-commit
package is installed:
sudo pip install pre-commit
- Go to repository root folder
- Install the pre-commit hooks:
pre-commit install
- Use pre-commit to check staged file:
pre-commit
- Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>
@yxieca @developfast @wangxin please help merge.
@yxieca @developfast @wangxin please help merge.
@yxieca @wangxin please help merge.