Converting legacy platform tests for a T2 chassis, adding validation of values to tests, and refactor test_sfp into smaller tests#2965
Conversation
|
This pull request introduces 2 alerts when merging 16e71b816b8d56f01dc0c05046bbeaa125829d73 into 451d052 - view on LGTM.com new alerts:
|
There was a problem hiding this comment.
I think we should expect the syseeprom_info field to be present in the inventory file to prevent skipping this test and potentially missing an issue. Maybe we should assert here and fail the test if not present?
There was a problem hiding this comment.
I was trying to keep it backward compatible. With your proposed change, it will enforce everybody to add syseeprom_info for all their devices into the inventory file. Is that what we want to do.
There was a problem hiding this comment.
Yes, that's what I'm inferring. In order to have a full, comprehensive test, syseeprom_info data should be added to the inventory file. I think the test should fail if there's nothing to test against. We are currently in the process of improving test coverage, so I think this assumption in fine moving forward. Thank you for considering backward compatibility here, but when it comes to testing, we need to set some ground rules.
Also, the platform API tests are designed to fail if the expected data is not found.
jleveque
left a comment
There was a problem hiding this comment.
I think it might be best to split tests/platform_tests/test_sfp.py into two files:
tests/platform_tests/test_sfputil.pytests/platform_tests/test_sfpshow.py
Thoughts?
|
how about splitting each show command into its own test in the same test_sfp.py |
I think it makes things cleaner to have one file dedicated to testing one utility. The |
…on of values to some tests
The following modifications are made to some of the legacy platform tests:
- conftest.py:
- Some of the platform tests run only on a supervisor card for a chassis.
So, needed to change rand_one_dut_hostname to enum_dut_supervisor_hostname.
However, in a multi-dut testbed that has no supervisor card (like DualTor),
we would raise an exception that no supervisor card is present. Instead,
we will now just return the first dut in the testbed.
- Modified generate_params_supervisor_hostname function for this behavior.
- test_xcvr_info_in_db.py:
- Use enum_rand_one_per_hwsku_frontend_hostname to run test against frontend
node instead of rand_one_dut_hostname that could give us a supervisor card.
- test_sfp:
- Use enum_rand_one_per_hwsku_frontend_hostname to run test against frontend
node instead of rand_one_dut_hostname
- Some of the new platforms don't support sfputils. So, added a check based
on the presence of file /usr/share/sonic/device/<platform>/plugins/spfutil.py"
If the file is not present, then we assume that sfputils is not supported.
In this case, we don't do sfputils related steps in test_check_sfp_status_and_configure_sfp test.
and skip test_check_sfp_low_power_mode test.
- test_show_platform.py:
- Use enum_rand_one_per_hwsku_frontend_hostname to run tests against frontend
node instead of rand_one_dut_hostname
- test_show_platform_summary:
- Added validation of fields in 'show platform summary' based on values in the inventory if defined.
- hwsku - based on 'hwsku' variable in the inventory
- platform - based on 'sonic_hw_platform' variable in the inventory
- asic - based on 'asic_type' variable in the inventory
- asic count - based on 'num_asics' variable in the inventory
- test_show_syseeprom:
- Validate values against 'syseeprom_info' dictionary if defined in the inventory
- test_show_platform_psustatus:
- Validate that atleast one of the PSU's shows status as OK.
- test_show_platform_fan:
- Validate that atleast one of the fans shows status as OK.
test_sfp.py: - removed check for spfutils not supported test_show_platform.py: - Removed extra spaces as per review comments
Broke up test_sfp into 3 tests for the 3 different modules being tested - sfpshow - test_sfpshow.py - sfputil - test_sfputil.py - show interface transciever - test_show_intf_xvrc.py The files were added into 'sfp' directory under platform tests to allow for reuse of utilities and fixtures. Removed original test_sfp.py from platform_tests directory.
ad7bc58 to
3197fa4
Compare
|
@jleveque Have refactored test_sfp into smaller tests under platform_tests/sfp. Please re-review. |
|
This pull request introduces 1 alert when merging b722eb6 into 856c106 - view on LGTM.com new alerts:
|
|
Done |
Description of PR
Summary:
Fixes # (issue)
Type of change
Approach
What is the motivation for this PR?
Need to run the legacy platform tests against a T2 chassis. However, some of the tests would run only on supervisor card, while others would run only on frontend nodes (linecards).
So, need to convert these tests to use the enum_* fixtures for dut selection, rather than rand_one_dut_hostname.
Also, we need to add some validation of the commands based on some variables that are defined in the inventory file - similar to the new PMON API validation.
How did you do it?
The following modifications are made to some of the legacy platform tests:
conftest.py:
test_xcvr_info_in_db.py:
test_sfp:
test_show_platform.py:
How did you verify/test it?
Validated the modified tests against a chassis and also a pizza box.
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation