-
Notifications
You must be signed in to change notification settings - Fork 819
[config reload] Fixing config reload when timer based delayed services are disabled #1967
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
Changes from 4 commits
497d9e0
8730bf2
c48d6cc
ed68ac1
b1b9679
263f3cb
e6f3ec0
7f0897a
6bf1631
93c44e1
3597962
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -733,7 +733,9 @@ def _get_sonic_services(): | |
|
|
||
| def _get_delayed_sonic_services(): | ||
| out = clicommon.run_command("systemctl list-dependencies --plain sonic-delayed.target | sed '1d'", return_cmd=True) | ||
| return (unit.strip().rstrip('.timer') for unit in out.splitlines()) | ||
| timers = [unit for unit in out.splitlines() if(clicommon.run_command("systemctl is-enabled {}".format(unit), | ||
|
||
| return_cmd=True).strip() == "enabled")] | ||
| return (unit.strip().rstrip('.timer') for unit in timers) | ||
|
|
||
|
|
||
| def _reset_failed_services(): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,6 +66,8 @@ def mock_run_command_side_effect(*args, **kwargs): | |
| return 'snmp.timer' | ||
| elif command == "systemctl list-dependencies --plain sonic.target | sed '1d'": | ||
| return 'swss' | ||
| elif command == "systemctl is-enabled snmp.timer": | ||
| return 'enabled' | ||
| else: | ||
| return '' | ||
|
|
||
|
|
@@ -92,7 +94,7 @@ def test_load_minigraph(self, get_cmd_module, setup_single_broadcom_asic): | |
| mock_run_command.assert_any_call('systemctl reset-failed swss') | ||
| # Verify "systemctl reset-failed" is called for services under sonic-delayed.target | ||
| mock_run_command.assert_any_call('systemctl reset-failed snmp') | ||
| assert mock_run_command.call_count == 10 | ||
| assert mock_run_command.call_count == 11 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dgsudharsan what this hard coded number stands for? should we count it in a better way than just a number?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe the logic is testing for number of calls to clicommon.run_command which is internal implementation. There is no way of knowing it in test script (even in the code). If tomorrow an additional command gets added this needs to be changed again. I agree this is not a deterministic method but its an existing code and I am not sure of the motivation. |
||
|
|
||
| def test_load_minigraph_with_port_config_bad_format(self, get_cmd_module, setup_single_broadcom_asic): | ||
| with mock.patch( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use one command to check all the units. You may use
xargsto bypass the command line too long issue. #Pending