def test_drive_selection(): devs = DeviceSelection(paths=['/dev/sda']) spec = DriveGroupSpec('node_name', data_devices=devs) assert spec.data_devices.paths == ['/dev/sda'] with pytest.raises(DriveGroupValidationError, match='exclusive'): DeviceSelection(paths=['/dev/sda'], rotates=False)
def test_drivegroup_pattern(): dg = DriveGroupSpec('node[1-3]', DeviceSelection()) assert dg.hosts(['node{}'.format(i) for i in range(10)]) == ['node1', 'node2', 'node3']