X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Fceph-volume%2Fceph_volume%2Ftests%2Fdevices%2Fsimple%2Ftest_activate.py;fp=src%2Fceph%2Fsrc%2Fceph-volume%2Fceph_volume%2Ftests%2Fdevices%2Fsimple%2Ftest_activate.py;h=bae3276a9b7689668e6b8734b9e0a0902e87ea1a;hb=812ff6ca9fcd3e629e49d4328905f33eee8ca3f5;hp=0000000000000000000000000000000000000000;hpb=15280273faafb77777eab341909a3f495cf248d9;p=stor4nfv.git diff --git a/src/ceph/src/ceph-volume/ceph_volume/tests/devices/simple/test_activate.py b/src/ceph/src/ceph-volume/ceph_volume/tests/devices/simple/test_activate.py new file mode 100644 index 0000000..bae3276 --- /dev/null +++ b/src/ceph/src/ceph-volume/ceph_volume/tests/devices/simple/test_activate.py @@ -0,0 +1,23 @@ +import os +import pytest +from ceph_volume.devices.simple import activate + + +class TestActivate(object): + + def test_no_data_uuid(self, factory, tmpfile, is_root, monkeypatch, capture): + json_config = tmpfile(contents='{}') + args = factory(osd_id='0', osd_fsid='1234', json_config=json_config) + with pytest.raises(RuntimeError): + activate.Activate([]).activate(args) + + def test_invalid_json_path(self): + os.environ['CEPH_VOLUME_SIMPLE_JSON_DIR'] = '/non/existing/path' + with pytest.raises(RuntimeError) as error: + activate.Activate(['1', 'asdf']).main() + assert 'RuntimeError: Expected JSON config path not found' in str(error) + + def test_main_spits_help_with_no_arguments(self, capsys): + activate.Activate([]).main() + stdout, stderr = capsys.readouterr() + assert 'Activate OSDs by mounting devices previously configured' in stdout