Adds tests for NRPE checks in Manila
Adds a test to ensure that Manila units related to NRPE get service check files created. Closes-Bug: #1925977
This commit is contained in:
@@ -23,6 +23,7 @@ from manilaclient import client as manilaclient
|
||||
|
||||
import zaza.model
|
||||
import zaza.openstack.configure.guest as guest
|
||||
import zaza.openstack.utilities.generic as generic_utils
|
||||
import zaza.openstack.utilities.openstack as openstack_utils
|
||||
import zaza.openstack.charm_tests.test_utils as test_utils
|
||||
import zaza.openstack.charm_tests.nova.utils as nova_utils
|
||||
@@ -85,6 +86,31 @@ class ManilaTests(test_utils.OpenStackBaseTest):
|
||||
def _list_shares(self):
|
||||
return self.manila_client.shares.list()
|
||||
|
||||
@tenacity.retry(
|
||||
retry=tenacity.retry_if_result(lambda ret: ret is not None),
|
||||
wait=tenacity.wait_fixed(120),
|
||||
stop=tenacity.stop_after_attempt(2))
|
||||
def _retry_check_commands_on_units(self, cmds, units):
|
||||
return generic_utils.check_commands_on_units(cmds, units)
|
||||
|
||||
def test_902_nrpe_service_checks(self):
|
||||
"""Confirm that the NRPE service check files are created."""
|
||||
units = zaza.model.get_units('manila')
|
||||
services = ['apache2', 'haproxy', 'manila-scheduler', 'manila-data']
|
||||
|
||||
cmds = []
|
||||
for check_name in services:
|
||||
cmds.append(
|
||||
'egrep -oh /usr/local.* /etc/nagios/nrpe.d/'
|
||||
'check_{}.cfg'.format(check_name)
|
||||
)
|
||||
|
||||
ret = self._retry_check_commands_on_units(cmds, units)
|
||||
if ret:
|
||||
logging.info(ret)
|
||||
|
||||
self.assertIsNone(ret, msg=ret)
|
||||
|
||||
|
||||
class ManilaBaseTest(test_utils.OpenStackBaseTest):
|
||||
"""Encapsulate a Manila basic functionality test."""
|
||||
|
||||
Reference in New Issue
Block a user