Mount installer root and ESP using their known filesystem types

This commit is contained in:
Codex
2026-10-13 22:29:56 +03:00
parent a77006a05f
commit 3c15890823
2 changed files with 25 additions and 4 deletions
+21
View File
@@ -187,6 +187,17 @@ class PartitionGuardTests(unittest.TestCase):
self.assertIn('/dev/vda3',topo.parents['/dev/loop0'])
self.assertEqual(i.validate_request(partition_request(),probe),'/dev/vda2')
def test_dry_run_mounts_use_requested_root_and_validated_esp_types(self):
for request in (i.Request('/dev/vda', 'emil'), partition_request()):
with self.subTest(mode='disk' if request.disk else 'partitions'):
target='/dev/vda' if request.disk else '/dev/vda2'
plan=i.render_plan(request,target,'/mnt/target')
self.assertIn('mount -t ext4 /dev/vda2 /mnt/target',plan)
self.assertIn('mount -t vfat /dev/vda1 /mnt/target/boot/efi',plan)
btrfs_plan=i.render_plan(partition_request(root_fs='btrfs'),'/dev/vda2','/mnt/target')
self.assertIn('mount -t btrfs -o subvol=@root /dev/vda2 /mnt/target',btrfs_plan)
self.assertIn('mount -t vfat /dev/vda1 /mnt/target/boot/efi',btrfs_plan)
def test_partition_plan_formats_only_root_and_preserves_efi(self):
req = partition_request()
plan = i.render_plan(req, '/dev/vda2', '/mnt/target')
@@ -279,6 +290,11 @@ class PartitionPipelineTests(unittest.TestCase):
self.assertEqual(runner.calls, [])
self.assertFalse((self.root/'etc/fstab').exists())
def test_partition_execution_mounts_known_filesystem_types_explicitly(self):
runner=FakeRunner(self.root); self.install(runner)
self.assertIn(['mount','-t','ext4','/dev/vda2',str(self.root)],runner.calls)
self.assertIn(['mount','-t','vfat','/dev/vda1',str(self.root/'boot/efi')],runner.calls)
def test_existing_mode_formats_root_only_and_records_owned_layout(self):
runner = FakeRunner(self.root)
self.install(runner)
@@ -518,6 +534,11 @@ class PipelineTests(unittest.TestCase):
self.assertIn('6.12.1', dracut)
self.assertEqual(runner.calls[-1], ['umount', str(self.root)])
def test_whole_disk_execution_mounts_created_filesystem_types_explicitly(self):
runner=FakeRunner(self.root); self.install(runner)
self.assertIn(['mount','-t','ext4','/dev/vda2',str(self.root)],runner.calls)
self.assertIn(['mount','-t','vfat','/dev/vda1',str(self.root/'boot/efi')],runner.calls)
def test_whole_disk_installs_owned_loader_and_fallback(self):
runner=FakeRunner(self.root); self.install(runner)
boot_commands=[c for c in runner.calls if 'grub-install' in c]