def test_is_not_mapper_device(self, device_info): device_info() disk = device.Device("/dev/sda") assert not disk.is_mapper
def test_is_ceph_disk_member_lsblk(self, device_info): lsblk = {"PARTLABEL": "ceph data"} device_info(lsblk=lsblk) disk = device.Device("/dev/sda") assert disk.is_ceph_disk_member
def test_partition_is_encrypted_blkid(self, device_info, pvolumes): lsblk = {'TYPE': 'part'} blkid = {'TYPE': 'crypto_LUKS'} device_info(lsblk=lsblk, blkid=blkid) disk = device.Device("/dev/sda") assert disk.is_encrypted is True
def test_is_mapper_device(self, device_info): device_info() disk = device.Device("/dev/mapper/foo") assert disk.is_mapper
def test_is_not_acceptable_device(self, device_info): data = {"/dev/dm-0": {"foo": "bar"}} lsblk = {"TYPE": "mpath"} device_info(devices=data, lsblk=lsblk) disk = device.Device("/dev/dm-0") assert not disk.is_device
def test_dm_is_mapper_device(self, device_info): lsblk = {"TYPE": "lvm"} device_info(lsblk=lsblk) disk = device.Device("/dev/dm-4") assert disk.is_mapper
def test_partlabel_lsblk(self, device_info): lsblk = {"PARTLABEL": ""} device_info(lsblk=lsblk) disk = device.CephDiskDevice(device.Device("/dev/sda")) assert disk.partlabel == ''
def test_device_is_not_rotational_lsblk(self, device_info): data = {"/dev/sda": {"rotational": "0"}} lsblk = {"TYPE": "device", "ROTA": "0"} device_info(devices=data, lsblk=lsblk) disk = device.Device("/dev/sda") assert not disk.rotational
def test_accept_non_readonly_device(self, device_info): data = {"/dev/sda": {"ro": 0}} device_info(devices=data) disk = device.Device("/dev/sda") assert disk.available
def test_dm_is_mapper_device(self, device_info): device_info() disk = device.Device("/dev/dm-4") assert disk.is_mapper
def test_reject_readonly_device(self, device_info): data = {"/dev/cdrom": {"ro": 1}} device_info(devices=data) disk = device.Device("/dev/cdrom") assert not disk.available
def test_accept_non_removable_device(self, device_info): data = {"/dev/sdb": {"removable": 0}} device_info(devices=data) disk = device.Device("/dev/sdb") assert disk.available
def test_reject_removable_device(self, device_info): data = {"/dev/sdb": {"removable": 1}} device_info(devices=data) disk = device.Device("/dev/sdb") assert not disk.available
def test_is_not_ceph_disk_member_lsblk(self, device_info): lsblk = {"PARTLABEL": "gluster partition"} device_info(lsblk=lsblk) disk = device.Device("/dev/sda") assert disk.is_ceph_disk_member is False
def test_is_lv(self, device_info): data = {"lv_path": "vg/lv", "vg_name": "vg"} device_info(lv=data) disk = device.Device("vg/lv") assert disk.is_lv
def test_sys_api(self, device_info): data = {"/dev/sda": {"foo": "bar"}} device_info(devices=data) disk = device.Device("/dev/sda") assert disk.sys_api assert "foo" in disk.sys_api
def test_is_member_lsblk(self, device_info, label): lsblk = {"PARTLABEL": label} device_info(lsblk=lsblk) disk = device.CephDiskDevice(device.Device("/dev/sda")) assert disk.is_member is True
def test_disk_is_device(self, device_info): data = {"/dev/sda": {"foo": "bar"}} lsblk = {"TYPE": "disk"} device_info(devices=data, lsblk=lsblk) disk = device.Device("/dev/sda") assert disk.is_device is True
def test_unknown_type(self, device_info): lsblk = {"PARTLABEL": "gluster"} device_info(lsblk=lsblk) disk = device.CephDiskDevice(device.Device("/dev/sda")) assert disk.type == 'unknown'
def test_is_lvm_memeber(self, device_info): data = {"/dev/sda1": {"foo": "bar"}} lsblk = {"TYPE": "part"} device_info(devices=data, lsblk=lsblk) disk = device.Device("/dev/sda1") assert not disk.is_lvm_member
def test_is_partition(self, device_info, pvolumes): data = {"/dev/sda": {"foo": "bar"}} lsblk = {"TYPE": "part"} device_info(devices=data, lsblk=lsblk) disk = device.Device("/dev/sda") assert disk.is_partition
def test_is_not_mapper_device(self, device_info): lsblk = {"TYPE": "disk"} device_info(lsblk=lsblk) disk = device.Device("/dev/sda") assert not disk.is_mapper
def test_partition_is_not_encrypted_lsblk(self, device_info, pvolumes): lsblk = {'TYPE': 'part', 'FSTYPE': 'xfs'} device_info(lsblk=lsblk) disk = device.Device("/dev/sda") assert disk.is_encrypted is False