From d7a5edc521435290ad0d1fb79e70918c649aebe7 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Wed, 18 Mar 2020 13:18:53 +0100 Subject: [PATCH] mgr/cephadm: pytest: Enable SpecStore Signed-off-by: Sebastian Wagner --- src/pybind/mgr/cephadm/tests/test_cephadm.py | 33 +++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) 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] -- 2.39.5