Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[thermalctld] Refactor to allow for greater unit test coverage; Add more unit tests #157

Merged
merged 43 commits into from
Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
011b96b
[thermalctld] Refactor to allow for greater unit test coverage
jleveque Feb 24, 2021
b814e16
Increase pytest verbosity
jleveque Feb 25, 2021
126263c
Refactor unit tests to align with source
jleveque Feb 25, 2021
2156279
Add mocked swsscommon lib
jleveque Feb 25, 2021
5198692
Remove THERMALCTLD_UNIT_TESTING env var
jleveque Feb 25, 2021
7663fa0
Use pytest fixture for setup/teardown
jleveque Feb 25, 2021
082f3c0
Use call_count in favor of assert_called[_once]
jleveque Feb 25, 2021
53fea67
Fix test bug and check both instances to ensure class var is correct
jleveque Feb 25, 2021
a2df880
[mock_platform] inherit from sonic_platform_base
jleveque Feb 25, 2021
aca1580
Update mock_platform.py
jleveque Feb 25, 2021
e25363c
Tests use new setters
jleveque Feb 25, 2021
02bc7ab
Use parens instead of escaping newlines
jleveque Feb 25, 2021
b118e0e
Change 'absence' to 'absent', 'fault' to 'faulty' where applicable
jleveque Feb 25, 2021
13ddb52
Add tests for signal handler
jleveque Feb 26, 2021
c72e31e
import sys
jleveque Feb 26, 2021
04eb5ef
Add MockThermalManager class to mock_platform.py
jleveque Feb 26, 2021
f4a036a
Replace 'deinit()' methods with actual destructors
jleveque Feb 26, 2021
ff163a7
Replace 'takes' with 'took'
jleveque Feb 26, 2021
ba8069e
Use more modern method of initializing base class
jleveque Feb 26, 2021
8b480d5
Go back to deinitializer methods
jleveque Feb 27, 2021
487278f
become -> became
jleveque Feb 27, 2021
873827e
Add tests for ThermalControlDaemon.run() and main()
jleveque Feb 27, 2021
79151bf
Add test_temperupdater_deinit
jleveque Feb 27, 2021
4d5f6ea
Grammar tweaks, pluralize message dynamically
jleveque Feb 27, 2021
0321f2a
Temp test
jleveque Feb 27, 2021
b9ae023
Remove unnecessary periods from log messages to align all
jleveque Feb 27, 2021
2e8409f
Add test case for TemperatureStatus.set_temperature when temp is not …
jleveque Feb 27, 2021
dd14af4
Add TestFanStatus class and test_check_speed_value_available method
jleveque Feb 27, 2021
c4de3fc
Add test case for try_get()
jleveque Feb 27, 2021
720b8b8
Add TestFanUpdater class and test_deinit() method
jleveque Feb 27, 2021
5315205
Add test case for FanUpdater._refresh_fan_drawer_status
jleveque Feb 27, 2021
f019f50
Fix grammar, add details to log messages
jleveque Feb 27, 2021
4f5db27
Add test case for update_entity_info()
jleveque Feb 28, 2021
006cbc9
Add test_set_fan_led_exception
jleveque Feb 28, 2021
637822b
[ThermalMonitor] Break loop logic out into separate function for unit…
jleveque Feb 28, 2021
74447f7
Add TestThermalMonitor class and test_main() method
jleveque Feb 28, 2021
04f0838
[TestFanUpdater] Add PSU fan test
jleveque Feb 28, 2021
41a3996
Add TestTemperatureUpdater class and test_update_psu_thermals() metho…
jleveque Feb 28, 2021
89a797f
Remove 'repr()' around exception to make log message identical betwee…
jleveque Feb 28, 2021
1c2c631
Check for more log messages
jleveque Feb 28, 2021
a5af749
Add MockSfpBase class to mock_platform.py
jleveque Feb 28, 2021
8e28094
Add test_update_sfp_thermals
jleveque Feb 28, 2021
3104fdf
Switch back to printing 'repr(e)'
jleveque Mar 18, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,12 @@ jobs:
set -xe
sudo pip2 install swsssdk-2.0.1-py2-none-any.whl
sudo pip2 install sonic_py_common-1.0-py2-none-any.whl
sudo pip2 install sonic_config_engine-1.0-py2-none-any.whl
sudo pip2 install sonic_platform_common-1.0-py2-none-any.whl
sudo pip3 install swsssdk-2.0.1-py3-none-any.whl
sudo pip3 install sonic_py_common-1.0-py3-none-any.whl
sudo pip3 install sonic_config_engine-1.0-py3-none-any.whl
sudo pip3 install sonic_platform_common-1.0-py3-none-any.whl
workingDirectory: $(Pipeline.Workspace)/target/python-wheels/
displayName: 'Install Python dependencies'

Expand Down
2 changes: 1 addition & 1 deletion sonic-thermalctld/pytest.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[pytest]
addopts = --cov=scripts --cov-report html --cov-report term --cov-report xml --junitxml=test-results.xml -v
addopts = --cov=scripts --cov-report html --cov-report term --cov-report xml --junitxml=test-results.xml -vv
326 changes: 180 additions & 146 deletions sonic-thermalctld/scripts/thermalctld

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion sonic-thermalctld/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
tests_require=[
'mock>=2.0.0; python_version < "3.3"',
'pytest',
'pytest-cov'
'pytest-cov',
'sonic-platform-common'
Copy link
Contributor

Choose a reason for hiding this comment

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

@jleveque this dependency is causing sonic-net/sonic-buildimage#7143 sonic-buildimage to fail.
Do we need to remove it or add something ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PR to add dependency in sonic-buildimage here

],
classifiers=[
'Development Status :: 4 - Beta',
Expand Down
Loading