test: check we always have a boot on lvmification

Check that the `ensureLVM` code creates a boot partition, if it does
not yet exist.
This commit is contained in:
Christian Kellner 2022-02-28 19:36:35 +01:00 committed by Achilleas Koutsou
parent 63aa1556fc
commit ddc0126a36

View file

@ -124,6 +124,45 @@ var testPartitionTables = map[string]PartitionTable{
},
},
"plain-noboot": {
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
Type: "gpt",
Partitions: []Partition{
{
Size: 1048576, // 1MB
Bootable: true,
Type: BIOSBootPartitionGUID,
UUID: BIOSBootPartitionUUID,
},
{
Size: 209715200, // 200 MB
Type: EFISystemPartitionGUID,
UUID: EFISystemPartitionUUID,
Payload: &Filesystem{
Type: "vfat",
UUID: EFIFilesystemUUID,
Mountpoint: "/boot/efi",
Label: "EFI-SYSTEM",
FSTabOptions: "defaults,uid=0,gid=0,umask=077,shortname=winnt",
FSTabFreq: 0,
FSTabPassNo: 2,
},
},
{
Type: FilesystemDataGUID,
UUID: RootPartitionUUID,
Payload: &Filesystem{
Type: "xfs",
Label: "root",
Mountpoint: "/",
FSTabOptions: "defaults",
FSTabFreq: 0,
FSTabPassNo: 0,
},
},
},
},
"luks": {
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
Type: "gpt",
@ -393,6 +432,11 @@ func TestCreatePartitionTableLVMify(t *testing.T) {
panic("no root mountpoint for PartitionTable")
}
bootPath := entityPath(mpt, "/boot")
if bootPath == nil {
panic("no boot mountpoint for PartitionTable")
}
parent := rootPath[1]
_, ok := parent.(*LVMLogicalVolume)
assert.True(ok, "Partition table '%s': root's parent (%q) is not an LVM logical volume", name, parent)