Fix OvercloudServicesTest for OSP 16

Service 'ntpd.service' is not expected to run on OSP 16

Change-Id: I23be4b4530c07b83bbb1512b0f97ab94f7eec3a2
This commit is contained in:
Federico Ressi 2021-09-03 10:09:58 +02:00
parent 019a30867a
commit 2f36a9acc6
2 changed files with 28 additions and 11 deletions

View File

@ -112,14 +112,15 @@ class OvercloudServicesTest(testtools.TestCase):
across the overcloud nodes
"""
services_status: services.OvercloudServicesStatus = (
tobiko.required_fixture(services.OvercloudServicesStatus))
def test_get_services_resource_table(self):
oss = services.OvercloudServicesStatus()
self.assertIsInstance(oss.oc_services_df,
self.assertIsInstance(self.services_status.oc_services_df,
pd.DataFrame)
def test_overcloud_services(self):
oss = services.OvercloudServicesStatus()
self.assertTrue(oss.basic_overcloud_services_running)
self.assertTrue(self.services_status.basic_overcloud_services_running)
def test_get_overcloud_nodes_running_pcs_resource(self):
nodes_list = pacemaker.get_overcloud_nodes_running_pcs_resource(

View File

@ -86,7 +86,7 @@ def check_if_process_running_on_overcloud(process):
return False
class OvercloudServicesStatus(object):
class OvercloudServicesStatus(tobiko.SharedFixture):
"""
class to handle services checks,
checks that all of these are running in the overcloud:
@ -94,12 +94,27 @@ class OvercloudServicesStatus(object):
'pacemaker.service','rpcbind.service','sshd.service'
"""
def __init__(self):
self.services_to_check = ['corosync.service', 'iptables.service',
'network.service', 'ntpd.service',
'pacemaker.service', 'rpcbind.service',
SERVICES_TO_CHECK: typing.List[str] = [
'corosync.service',
'iptables.service',
'network.service',
# Not found on OSP 16
# 'ntpd.service',
'pacemaker.service',
'rpcbind.service',
'sshd.service']
def __init__(self,
services_to_check: typing.List[str] = None):
super().__init__()
if services_to_check is None:
services_to_check = self.SERVICES_TO_CHECK
self.services_to_check = services_to_check
oc_services_df: typing.Any
def setup_fixture(self):
self.oc_services_df = overcloud.get_overcloud_nodes_dataframe(
get_overcloud_node_services_table)
@ -110,6 +125,7 @@ class OvercloudServicesStatus(object):
running
:return: Bool
"""
tobiko.setup_fixture(self)
for service_name in self.services_to_check:
if not self.oc_services_df.query('UNIT=="{}"'.format(
service_name)).empty: