]>
git.proxmox.com Git - ceph.git/blob - ceph/src/ceph-volume/ceph_volume/tests/util/test_disk.py
1 from ceph_volume
.util
import disk
4 class TestLsblkParser(object):
6 def test_parses_whitespace_values(self
):
7 output
= 'NAME="sdaa5" PARTLABEL="ceph data" RM="0" SIZE="10M" RO="0" TYPE="part"'
8 result
= disk
._lsblk
_parser
(output
)
9 assert result
['PARTLABEL'] == 'ceph data'
11 def test_ignores_bogus_pairs(self
):
12 output
= 'NAME="sdaa5" PARTLABEL RM="0" SIZE="10M" RO="0" TYPE="part" MOUNTPOINT=""'
13 result
= disk
._lsblk
_parser
(output
)
14 assert result
['SIZE'] == '10M'
17 class TestDeviceFamily(object):
19 def test_groups_multiple_devices(self
, stub_call
):
21 'NAME="sdaa5" PARLABEL="ceph lockbox"',
23 'NAME="sdaa1" PARLABEL="ceph data"',
24 'NAME="sdaa2" PARLABEL="ceph journal"',
26 stub_call((out
, '', 0))
27 result
= disk
.device_family('sdaa5')
28 assert len(result
) == 4
30 def test_parses_output_correctly(self
, stub_call
):
31 names
= ['sdaa', 'sdaa5', 'sdaa1', 'sdaa2']
33 'NAME="sdaa5" PARLABEL="ceph lockbox"',
35 'NAME="sdaa1" PARLABEL="ceph data"',
36 'NAME="sdaa2" PARLABEL="ceph journal"',
38 stub_call((out
, '', 0))
39 result
= disk
.device_family('sdaa5')
41 assert parsed
['NAME'] in names