Skip to content
Merged
Changes from 9 commits
Commits
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
26 changes: 26 additions & 0 deletions tests/monit/test_monit_service_status.py
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):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggest shortening the name of this function and the file to test_monit_status

"""
@summary: Test the running status of Monit service by analyzing the command
output of "sudo systemctl status monit.service | grep Active".
Copy link
Copy Markdown
Contributor

@jleveque jleveque Oct 10, 2020

Choose a reason for hiding this comment

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

This summary is now out of date and references the wrong command. Suggest removing the command from it altogether, as the command is two lines below and the function is simple.

"""
monit_service_status_info = duthost.shell("sudo monit status", module_ignore_errors=True)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggest renaming var to monit_status_result


exit_code = monit_service_status_info["rc"]
if exit_code == 0:
logger.info("Monit service is running.")
else:
pytest.fail("Monit service is not running.")