-
Notifications
You must be signed in to change notification settings - Fork 1k
[pytest] Test the running status of Monit service #2309
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 6 commits
2e16676
ed8c8e3
5a6e823
a4021ed
cc6c755
5609843
36c56cb
7b233be
5b9857e
686a13a
8a199ba
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 |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| """ | ||
| Test the running status of Monit service | ||
| """ | ||
| import logging | ||
|
|
||
| import pytest | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
| pytestmark = [ | ||
| pytest.mark.topology('any') | ||
| ] | ||
|
|
||
|
|
||
| def test_monit_service_status(duthost): | ||
| """ | ||
| @summary: Test the running status of Monit service by analyzing the command | ||
| output of "sudo systemctl status monit.service | grep Active". | ||
| """ | ||
| monit_service_status_info = duthost.shell("sudo systemctl status monit.service | grep Active") | ||
|
||
|
|
||
| status_line = monit_service_status_info["stdout_lines"][0].strip() | ||
| if "active" in status_line: | ||
| logger.info("Monit service is running.") | ||
| else: | ||
| pytest.fail("Monit service is not running: '{}'".format(status_line)) | ||
Uh oh!
There was an error while loading. Please reload this page.