From: Sebastian Wagner Date: Wed, 18 Mar 2020 12:18:53 +0000 (+0100) Subject: mgr/cephadm: pytest: Enable SpecStore X-Git-Tag: v15.2.0~22^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F34001%2Fhead;p=ceph.git mgr/cephadm: pytest: Enable SpecStore Signed-off-by: Sebastian Wagner --- diff --git a/src/pybind/mgr/cephadm/tests/test_cephadm.py b/src/pybind/mgr/cephadm/tests/test_cephadm.py index b5f8219e4179d..60c6f12e6d19e 100644 --- a/src/pybind/mgr/cephadm/tests/test_cephadm.py +++ b/src/pybind/mgr/cephadm/tests/test_cephadm.py @@ -302,61 +302,56 @@ class TestCephadm(object): assert wait(cephadm_module, c) == ['Set ident light for test: on'] @mock.patch("cephadm.module.CephadmOrchestrator._run_cephadm", _run_cephadm('{}')) - @mock.patch("cephadm.module.SpecStore.save") - def test_apply_mgr_save(self, _save_spec, cephadm_module): + def test_apply_mgr_save(self, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test'], count=1) spec = ServiceSpec('mgr', placement=ps) c = cephadm_module.apply_mgr(spec) assert wait(cephadm_module, c) == 'Scheduled mgr update...' - _save_spec.assert_called_with(spec) + assert wait(cephadm_module, cephadm_module.list_specs()) == [spec] @mock.patch("cephadm.module.CephadmOrchestrator._run_cephadm", _run_cephadm('{}')) - @mock.patch("cephadm.module.SpecStore.save") - def test_apply_mds_save(self, _save_spec, cephadm_module): + def test_apply_mds_save(self, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test'], count=1) spec = ServiceSpec('mds', 'fsname', placement=ps) c = cephadm_module.apply_mds(spec) assert wait(cephadm_module, c) == 'Scheduled mds update...' - _save_spec.assert_called_with(spec) + assert wait(cephadm_module, cephadm_module.list_specs()) == [spec] @mock.patch("cephadm.module.CephadmOrchestrator._run_cephadm", _run_cephadm('{}')) - @mock.patch("cephadm.module.SpecStore.save") - def test_apply_rgw_save(self, _save_spec, cephadm_module): + def test_apply_rgw_save(self, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test'], count=1) spec = ServiceSpec('rgw', 'r.z', placement=ps) c = cephadm_module.apply_rgw(spec) assert wait(cephadm_module, c) == 'Scheduled rgw update...' - _save_spec.assert_called_with(spec) + assert wait(cephadm_module, cephadm_module.list_specs()) == [spec] @mock.patch("cephadm.module.CephadmOrchestrator._run_cephadm", _run_cephadm('{}')) - @mock.patch("cephadm.module.SpecStore.save") - def test_apply_rbd_mirror_save(self, _save_spec, cephadm_module): + def test_apply_rbd_mirror_save(self, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test'], count=1) spec = ServiceSpec('rbd-mirror', placement=ps) c = cephadm_module.apply_rbd_mirror(spec) assert wait(cephadm_module, c) == 'Scheduled rbd-mirror update...' - _save_spec.assert_called_with(spec) + assert wait(cephadm_module, cephadm_module.list_specs()) == [spec] @mock.patch("cephadm.module.CephadmOrchestrator._run_cephadm", _run_cephadm('{}')) - @mock.patch("cephadm.module.SpecStore.save") - def test_apply_prometheus_save(self, _save_spec, cephadm_module): + def test_apply_prometheus_save(self, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test'], count=1) spec = ServiceSpec('prometheus', placement=ps) c = cephadm_module.apply_prometheus(spec) assert wait(cephadm_module, c) == 'Scheduled prometheus update...' - _save_spec.assert_called_with(spec) + assert wait(cephadm_module, cephadm_module.list_specs()) == [spec] @mock.patch("cephadm.module.CephadmOrchestrator._run_cephadm", _run_cephadm('{}')) - @mock.patch("cephadm.module.SpecStore.save") - def test_apply_node_exporter_save(self, _save_spec, cephadm_module): + def test_apply_node_exporter_save(self, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test'], count=1) - spec = ServiceSpec('node-exporter', placement=ps) + spec = ServiceSpec('node-exporter', placement=ps, service_id='my_exporter') c = cephadm_module.apply_node_exporter(spec) assert wait(cephadm_module, c) == 'Scheduled node-exporter update...' - _save_spec.assert_called_with(spec) + assert wait(cephadm_module, cephadm_module.list_specs()) == [spec] + assert wait(cephadm_module, cephadm_module.list_specs('node-exporter.my_exporter')) == [spec]