]> git.proxmox.com Git - ceph.git/blob - ceph/src/ceph-volume/ceph_volume/tests/devices/simple/test_activate.py
update sources to 12.2.2
[ceph.git] / ceph / src / ceph-volume / ceph_volume / tests / devices / simple / test_activate.py
1 import os
2 import pytest
3 from ceph_volume.devices.simple import activate
4
5
6 class TestActivate(object):
7
8 def test_no_data_uuid(self, factory, tmpfile, is_root, monkeypatch, capture):
9 json_config = tmpfile(contents='{}')
10 args = factory(osd_id='0', osd_fsid='1234', json_config=json_config)
11 with pytest.raises(RuntimeError):
12 activate.Activate([]).activate(args)
13
14 def test_invalid_json_path(self):
15 os.environ['CEPH_VOLUME_SIMPLE_JSON_DIR'] = '/non/existing/path'
16 with pytest.raises(RuntimeError) as error:
17 activate.Activate(['1', 'asdf']).main()
18 assert 'RuntimeError: Expected JSON config path not found' in str(error)
19
20 def test_main_spits_help_with_no_arguments(self, capsys):
21 activate.Activate([]).main()
22 stdout, stderr = capsys.readouterr()
23 assert 'Activate OSDs by mounting devices previously configured' in stdout