@@ -405,15 +405,36 @@ def test_manifest_anaconda_module_customizations(tmpdir_factory, build_container
405
405
assert "org.fedoraproject.Anaconda.Modules.Timezone" not in st ["options" ]["activatable-modules" ]
406
406
407
407
408
- def find_fstab_stage_from (manifest_str ):
408
+ def find_fs_mount_info_from (manifest_str ):
409
409
manifest = json .loads (manifest_str )
410
+ mount_stages = []
411
+ # normally there should be only one swap partition, but there's no technical reason you can't have multiple
412
+ swap_stages = []
410
413
for pipeline in manifest ["pipelines" ]:
411
- # the fstab stage in cross-arch manifests is in the "ostree-deployment" pipeline
414
+ # the mount unit stages in cross-arch manifests are in the "ostree-deployment" pipeline
412
415
if pipeline ["name" ] in ("image" , "ostree-deployment" ):
413
416
for st in pipeline ["stages" ]:
414
- if st ["type" ] == "org.osbuild.fstab" :
415
- return st
416
- raise ValueError (f"cannot find fstab stage in manifest:\n { manifest_str } " )
417
+ if st ["type" ] == "org.osbuild.systemd.unit.create" :
418
+ options = st ["options" ]
419
+ if options ["filename" ].endswith (".mount" ):
420
+ mount_stages .append (st )
421
+ elif options ["filename" ].endswith (".swap" ):
422
+ swap_stages .append (st )
423
+
424
+ if not mount_stages :
425
+ raise ValueError (f"cannot find mount unit creation stages in manifest:\n { manifest_str } " )
426
+
427
+ mounts = []
428
+ for stage in mount_stages :
429
+ options = stage ["options" ]["config" ]
430
+ mounts .append (options ["Mount" ])
431
+
432
+ swaps = []
433
+ for stage in swap_stages :
434
+ options = stage ["options" ]["config" ]
435
+ swaps .append (options ["Swap" ])
436
+
437
+ return mounts , swaps
417
438
418
439
419
440
@pytest .mark .parametrize ("fscustomizations,rootfs" , [
@@ -480,25 +501,23 @@ def test_manifest_fs_customizations_smoke_toml(tmp_path, build_container):
480
501
481
502
482
503
def assert_fs_customizations (customizations , fstype , manifest ):
483
- # use the fstab stage to get filesystem types for each mountpoint
484
- fstab_stage = find_fstab_stage_from (manifest )
485
- filesystems = fstab_stage ["options" ]["filesystems" ]
504
+ mounts , _ = find_fs_mount_info_from (manifest )
486
505
487
506
manifest_mountpoints = set ()
488
- for fs in filesystems :
489
- manifest_mountpoints .add (fs [ "path " ])
490
- if fs [ "path " ] == "/boot/efi" :
491
- assert fs [ "vfs_type " ] == "vfat"
507
+ for mount in mounts :
508
+ manifest_mountpoints .add (mount [ "Where " ])
509
+ if mount [ "Where " ] == "/boot/efi" :
510
+ assert mount [ "Type " ] == "vfat"
492
511
continue
493
512
494
- if fstype == "btrfs" and fs [ "path " ] == "/boot" :
513
+ if fstype == "btrfs" and mount [ "Where " ] == "/boot" :
495
514
# /boot keeps its default fstype when using btrfs
496
- assert fs [ "vfs_type " ] == "ext4"
515
+ assert mount [ "Type " ] == "ext4"
497
516
continue
498
517
499
- assert fs [ "vfs_type " ] == fstype , f"incorrect filesystem type for { fs [ 'path ' ]} "
518
+ assert mount [ "Type " ] == fstype , f"incorrect filesystem type for { mount [ 'Where ' ]} "
500
519
501
- # check that all fs customizations appear in fstab
520
+ # check that all fs customizations appear in the manifest
502
521
for custom_mountpoint in customizations :
503
522
assert custom_mountpoint in manifest_mountpoints
504
523
@@ -699,14 +718,12 @@ def test_manifest_disk_customization_swap(tmp_path, build_container):
699
718
mkswap_stage = find_mkswap_stage_from (output )
700
719
assert mkswap_stage ["options" ].get ("uuid" )
701
720
swap_uuid = mkswap_stage ["options" ]["uuid" ]
702
- fstab_stage = find_fstab_stage_from (output )
703
- filesystems = fstab_stage [ "options" ][ "filesystems" ]
721
+ _ , swaps = find_fs_mount_info_from (output )
722
+ what_node = f"/dev/disk/by-uuid/ { swap_uuid } "
704
723
assert {
705
- 'uuid' : swap_uuid ,
706
- "vfs_type" : "swap" ,
707
- "path" : "none" ,
708
- "options" : "defaults" ,
709
- } in filesystems
724
+ "What" : what_node ,
725
+ "Options" : "defaults" ,
726
+ } in swaps
710
727
711
728
712
729
def test_manifest_disk_customization_lvm_swap (tmp_path , build_container ):
@@ -744,14 +761,12 @@ def test_manifest_disk_customization_lvm_swap(tmp_path, build_container):
744
761
mkswap_stage = find_mkswap_stage_from (output )
745
762
assert mkswap_stage ["options" ].get ("uuid" )
746
763
swap_uuid = mkswap_stage ["options" ]["uuid" ]
747
- fstab_stage = find_fstab_stage_from (output )
748
- filesystems = fstab_stage [ "options" ][ "filesystems" ]
764
+ _ , swaps = find_fs_mount_info_from (output )
765
+ what_node = f"/dev/disk/by-uuid/ { swap_uuid } "
749
766
assert {
750
- 'uuid' : swap_uuid ,
751
- "vfs_type" : "swap" ,
752
- "path" : "none" ,
753
- "options" : "defaults" ,
754
- } in filesystems
767
+ "What" : what_node ,
768
+ "Options" : "defaults" ,
769
+ } in swaps
755
770
# run osbuild schema validation, see gh#748
756
771
if not testutil .has_executable ("osbuild" ):
757
772
pytest .skip ("no osbuild executable" )
0 commit comments