Merge pull request #624 from gustavosr98/master

Adds tests for NRPE checks in Manila
This commit is contained in:
Aurelien Lourot
2021-09-09 15:20:37 +02:00
committed by GitHub

View File

@@ -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,27 @@ class ManilaTests(test_utils.OpenStackBaseTest):
def _list_shares(self):
return self.manila_client.shares.list()
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)
)
for attempt in tenacity.Retrying(
wait=tenacity.wait_fixed(20),
stop=tenacity.stop_after_attempt(2),
reraise=True
):
with attempt:
ret = generic_utils.check_commands_on_units(cmds, units)
self.assertIsNone(ret, msg=ret)
class ManilaBaseTest(test_utils.OpenStackBaseTest):
"""Encapsulate a Manila basic functionality test."""