def test_mon_update(self, _send_command, _get_connection, _save_host, _rm_host, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test:0.0.0.0=a'], count=1) c = cephadm_module.add_mon(ServiceSpec('mon', placement=ps)) assert wait(cephadm_module, c) == ["Deployed mon.a on host 'test'"] with pytest.raises(OrchestratorError, match="is missing a network spec"): ps = PlacementSpec(hosts=['test'], count=1) c = cephadm_module.add_mon(ServiceSpec('mon', placement=ps)) wait(cephadm_module, c)
def test_mon_add(self, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test:0.0.0.0=a'], count=1) c = cephadm_module.add_mon(ServiceSpec('mon', placement=ps)) assert wait(cephadm_module, c) == ["Deployed mon.a on host 'test'"] with pytest.raises( OrchestratorError, match= "Must set public_network config option or specify a CIDR network," ): ps = PlacementSpec(hosts=['test'], count=1) c = cephadm_module.add_mon(ServiceSpec('mon', placement=ps)) wait(cephadm_module, c)
def test_prometheus(self, _send_command, _get_connection, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test'], count=1) c = cephadm_module.add_prometheus(ServiceSpec(placement=ps)) [out] = wait(cephadm_module, c) assert "Deployed prometheus." in out assert " on host 'test'" in out ps = PlacementSpec(hosts=['test'], count=2) c = cephadm_module.apply_prometheus(ServiceSpec(placement=ps)) [out] = wait(cephadm_module, c) assert "Deployed prometheus." in out assert " on host 'test'" in out
def test_rbd_mirror(self, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test'], count=1) c = cephadm_module.add_rbd_mirror( ServiceSpec('rbd-mirror', placement=ps)) [out] = wait(cephadm_module, c) match_glob(out, "Deployed rbd-mirror.* on host 'test'")
def test_mds(self, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test'], count=1) c = cephadm_module.add_mds(ServiceSpec('mds', 'name', placement=ps)) [out] = wait(cephadm_module, c) match_glob(out, "Deployed mds.name.* on host 'test'")
def test_mgr_update(self, _send_command, _get_connection, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test:0.0.0.0=a'], count=1) c = cephadm_module.update_mgrs(ServiceSpec(placement=ps)) [out] = wait(cephadm_module, c) assert "Deployed mgr." in out assert " on host 'test'" in out
def test_apply_node_exporter_save(self, _send_command, _get_connection, _save_spec, _save_host, _rm_host, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test'], count=1) spec = ServiceSpec('node_exporter', placement=ps) c = cephadm_module.apply_node_exporter(spec) _save_spec.assert_called_with(spec) assert wait(cephadm_module, c) == 'Scheduled node_exporter update...'
def test_rbd_mirror(self, _send_command, _get_connection, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test'], count=1) c = cephadm_module.add_rbd_mirror( ServiceSpec(name='name', placement=ps)) [out] = wait(cephadm_module, c) match_glob(out, "Deployed rbd-mirror.* on host 'test'")
def test_rbd_mirror(self, _send_command, _get_connection, _save_host, _rm_host, cephadm_module): # type: (mock.Mock, mock.Mock, mock.Mock, mock.Mock, CephadmOrchestrator) -> None with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test'], count=1) c = cephadm_module.add_rbd_mirror(ServiceSpec('rbd-mirror', placement=ps)) [out] = wait(cephadm_module, c) match_glob(out, "Deployed rbd-mirror.* on host 'test'")
def test_prometheus(self, _send_command, _get_connection, _save_host, _rm_host, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test'], count=1) c = cephadm_module.add_prometheus(ServiceSpec('prometheus', placement=ps)) [out] = wait(cephadm_module, c) match_glob(out, "Deployed prometheus.* on host 'test'")
def test_mds(self, _send_command, _get_connection, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test'], count=1) c = cephadm_module.add_mds(ServiceSpec('name', placement=ps)) [out] = wait(cephadm_module, c) assert "Deployed mds.name." in out assert " on host 'test'" in out
def test_mgr_update(self, _send_command, _get_connection, _save_host, _rm_host, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test:0.0.0.0=a'], count=1) c = cephadm_module.apply_mgr(ServiceSpec(placement=ps)) [out] = wait(cephadm_module, c) match_glob(out, "Deployed mgr.* on host 'test'")
def test_apply_prometheus_save(self, _save_spec, 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) _save_spec.assert_called_with(spec) assert wait(cephadm_module, c) == 'Scheduled prometheus update...'
def test_apply_rbd_mirror_save(self, _save_spec, 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) _save_spec.assert_called_with(spec) assert wait(cephadm_module, c) == 'Scheduled rbd-mirror update...'
def test_node_assignment3(service_type, placement, hosts, daemons, expected_len, must_have): s = HostAssignment(spec=ServiceSpec(service_type, placement=placement), get_hosts_func=lambda _: hosts, get_daemons_func=lambda _: daemons).load() assert len(s.placement.hosts) == expected_len for h in must_have: assert h in [h.hostname for h in s.placement.hosts]
def test_node_assignment2(service_type, placement, hosts, daemons, expected_len, in_set): hosts = HostAssignment(spec=ServiceSpec(service_type, placement=placement), get_hosts_func=lambda _: hosts, get_daemons_func=lambda _: daemons).place() assert len(hosts) == expected_len for h in [h.hostname for h in hosts]: assert h in in_set
def test_grafana(self, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test'], count=1) c = cephadm_module.add_grafana(ServiceSpec('grafana', placement=ps)) [out] = wait(cephadm_module, c) match_glob(out, "Deployed grafana.* on host 'test'")
def test_alertmanager(self, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test'], count=1) c = cephadm_module.add_alertmanager( ServiceSpec('alertmanager', placement=ps)) [out] = wait(cephadm_module, c) match_glob(out, "Deployed alertmanager.* on host 'test'")
def test_mgr_update(self, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test:0.0.0.0=a'], count=1) r = cephadm_module._apply_service(ServiceSpec('mgr', placement=ps)) assert r
def test_node_assignment(service_type, placement, hosts, daemons, expected): s = HostAssignment(spec=ServiceSpec(service_type, placement=placement), get_hosts_func=lambda _: hosts, get_daemons_func=lambda _: daemons).load() assert sorted([h.hostname for h in s.placement.hosts]) == sorted(expected)
def test_mon_update(self, _send_command, _get_connection, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test:0.0.0.0=a'], count=1) c = cephadm_module.update_mons(ServiceSpec(placement=ps)) assert wait(cephadm_module, c) == ["Deployed mon.a on host 'test'"]