From e58e86b215245dd60f4ba199c4274e49b3b6f26d Mon Sep 17 00:00:00 2001 From: Paul Cuzner Date: Wed, 18 Nov 2020 09:39:03 +1300 Subject: [PATCH] cephadm: tests - add cephadm-exporter to service check Add cephadm-exporter service, and confirm the instance doesn't contain ceph methods like get_auth_entity (same approach as taken for the monitoring stack) Signed-off-by: Paul Cuzner --- src/pybind/mgr/cephadm/tests/test_services.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/cephadm/tests/test_services.py b/src/pybind/mgr/cephadm/tests/test_services.py index 2a66665bb6305..da53e51014591 100644 --- a/src/pybind/mgr/cephadm/tests/test_services.py +++ b/src/pybind/mgr/cephadm/tests/test_services.py @@ -3,7 +3,7 @@ import pytest from unittest.mock import MagicMock from cephadm.services.cephadmservice import MonService, MgrService, MdsService, RgwService, \ - RbdMirrorService, CrashService, CephadmService, AuthEntity + RbdMirrorService, CrashService, CephadmService, AuthEntity, CephadmExporter from cephadm.services.iscsi import IscsiService from cephadm.services.nfs import NFSService from cephadm.services.osd import RemoveUtil, OSDQueue, OSDService, OSD, NotFoundError @@ -57,6 +57,7 @@ class TestCephadmService: node_exporter_service = NodeExporterService(mgr) crash_service = CrashService(mgr) iscsi_service = IscsiService(mgr) + cephadm_exporter_service = CephadmExporter(mgr) cephadm_services = { 'mon': mon_service, 'mgr': mgr_service, @@ -71,6 +72,7 @@ class TestCephadmService: 'node-exporter': node_exporter_service, 'crash': crash_service, 'iscsi': iscsi_service, + 'cephadm-exporter': cephadm_exporter_service, } return cephadm_services @@ -108,8 +110,9 @@ class TestCephadmService: assert "%s.id1" % daemon_type == \ cephadm_services[daemon_type].get_auth_entity("id1") + # services based on CephadmService shouldn't have get_auth_entity with pytest.raises(AttributeError): - for daemon_type in ['grafana', 'alertmanager', 'prometheus', 'node-exporter']: + for daemon_type in ['grafana', 'alertmanager', 'prometheus', 'node-exporter', 'cephadm-exporter']: cephadm_services[daemon_type].get_auth_entity("id1", "host") cephadm_services[daemon_type].get_auth_entity("id1", "") cephadm_services[daemon_type].get_auth_entity("id1") -- 2.39.5