debian-forge/devices/test/test_lv.py
Michael Vogt ca558c2479 devices: create /dev/mapper/<logical-volume> as well
When we create the device node inside the buildroot so far it's
very minimal - just `/dev/{vg}-{lv}` with the appopriate major/minor.

However when mount runs it will create a mapper device with the
same major/minor under `/dev/mapper/{escaped(vg)}-{escaped(lv)}`
and use that to mount the actual filesystem. Without this additional
device findmnt will not be able to detect the udev attributes of
the source (as the source is just missing from /dev).

This commit create the right mapper in the same way that we
create the non-mapper device node.
2024-08-27 13:52:59 +02:00

17 lines
622 B
Python

import pytest
DEVICES_NAME = "org.osbuild.lvm2.lv"
@pytest.mark.parametrize("parent,options,expected_parent_path", [
("loop2", {}, "/dev/loop2"),
("loop1", {"vg_partnum": 2}, "/dev/loop1p2"),
])
def test_lvm2_lv_get_parent_path(devices_module, parent, options, expected_parent_path):
pp = devices_module.get_parent_path(parent, options)
assert pp == expected_parent_path
def test_lvm2_escaped_lv_mapper_name(devices_module):
expected = "1d2b2150--8de2--4b68--b387--f9bc709190e8-lvroot"
assert devices_module.escaped_lv_mapper_name("1d2b2150-8de2-4b68-b387-f9bc709190e8", "lvroot") == expected