]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: pytest: Enable SpecStore 34001/head
authorSebastian Wagner <sebastian.wagner@suse.com>
Wed, 18 Mar 2020 12:18:53 +0000 (13:18 +0100)
committerSebastian Wagner <sebastian.wagner@suse.com>
Wed, 18 Mar 2020 12:44:49 +0000 (13:44 +0100)
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
src/pybind/mgr/cephadm/tests/test_cephadm.py

index b5f8219e4179d0c70281ab46977b9acd79f99e0f..60c6f12e6d19e555a241e3a2efca6b6bb1b4531e 100644 (file)
@@ -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]