Exemple #1
0
    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)
Exemple #2
0
    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)
Exemple #3
0
    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
Exemple #4
0
 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'")
Exemple #5
0
 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'")
Exemple #6
0
 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
Exemple #7
0
 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...'
Exemple #8
0
 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'")
Exemple #9
0
 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'")
Exemple #10
0
    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'")
Exemple #11
0
 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
Exemple #12
0
 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'")
Exemple #13
0
 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...'
Exemple #14
0
 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...'
Exemple #15
0
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]
Exemple #16
0
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
Exemple #17
0
    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'")
Exemple #18
0
    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'")
Exemple #19
0
 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
Exemple #20
0
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)
Exemple #21
0
 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'"]