]> git.proxmox.com Git - ceph.git/blob - ceph/src/ceph-volume/ceph_volume/tests/devices/lvm/test_trigger.py
update sources to v12.1.3
[ceph.git] / ceph / src / ceph-volume / ceph_volume / tests / devices / lvm / test_trigger.py
1 import pytest
2 from ceph_volume import exceptions
3 from ceph_volume.devices.lvm import trigger
4
5
6 class TestParseOSDid(object):
7
8 def test_no_id_found_if_no_digit(self):
9 with pytest.raises(exceptions.SuffixParsingError):
10 trigger.parse_osd_id('asdlj-ljahsdfaslkjhdfa')
11
12 def test_no_id_found(self):
13 with pytest.raises(exceptions.SuffixParsingError):
14 trigger.parse_osd_id('ljahsdfaslkjhdfa')
15
16 def test_id_found(self):
17 result = trigger.parse_osd_id('1-ljahsdfaslkjhdfa')
18 assert result == '1'
19
20
21 class TestParseOSDUUID(object):
22
23 def test_uuid_is_parsed(self):
24 result = trigger.parse_osd_uuid('1-asdf-ljkh-asdf-ljkh-asdf')
25 assert result == 'asdf-ljkh-asdf-ljkh-asdf'
26
27 def test_uuid_is_parsed_longer_sha1(self):
28 result = trigger.parse_osd_uuid('1-foo-bar-asdf-ljkh-asdf-ljkh-asdf')
29 assert result == 'foo-bar-asdf-ljkh-asdf-ljkh-asdf'
30
31 def test_uuid_is_not_found(self):
32 with pytest.raises(exceptions.SuffixParsingError):
33 trigger.parse_osd_uuid('ljahsdfaslkjhdfa')
34
35 def test_uuid_is_not_found_missing_id(self):
36 with pytest.raises(exceptions.SuffixParsingError):
37 trigger.parse_osd_uuid('ljahs-dfa-slkjhdfa-foo')
38
39