]>
git.proxmox.com Git - ceph.git/blob - ceph/src/ceph-volume/ceph_volume/tests/devices/lvm/test_trigger.py
2 from ceph_volume
import exceptions
3 from ceph_volume
.devices
.lvm
import trigger
6 class TestParseOSDid(object):
8 def test_no_id_found_if_no_digit(self
):
9 with pytest
.raises(exceptions
.SuffixParsingError
):
10 trigger
.parse_osd_id('asdlj-ljahsdfaslkjhdfa')
12 def test_no_id_found(self
):
13 with pytest
.raises(exceptions
.SuffixParsingError
):
14 trigger
.parse_osd_id('ljahsdfaslkjhdfa')
16 def test_id_found(self
):
17 result
= trigger
.parse_osd_id('1-ljahsdfaslkjhdfa')
21 class TestParseOSDUUID(object):
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'
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'
31 def test_uuid_is_not_found(self
):
32 with pytest
.raises(exceptions
.SuffixParsingError
):
33 trigger
.parse_osd_uuid('ljahsdfaslkjhdfa')
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')