@@ -544,8 +544,8 @@ def test_build_container_works(image_type):
544544
545545
546546def assert_kernel_args (test_vm , image_type ):
547- exit_status , kcmdline = test_vm .run ("cat /proc/cmdline" , user = image_type .username , password = image_type .password )
548- assert exit_status == 0
547+ ret = test_vm .run ([ "cat" , " /proc/cmdline"] , user = image_type .username , password = image_type .password )
548+ kcmdline = ret . stdout
549549 # the kernel arg string must have a space as the prefix and either a space
550550 # as suffix or be the last element of the kernel commandline
551551 assert re .search (f" { re .escape (image_type .kargs )} ( |$)" , kcmdline )
@@ -560,31 +560,27 @@ def test_image_boots(image_type):
560560def assert_disk_image_boots (image_type ):
561561 with QEMU (image_type .img_path , arch = image_type .img_arch ) as test_vm :
562562 # user/password login works
563- exit_status , _ = test_vm .run ("true" , user = image_type .username , password = image_type .password )
564- assert exit_status == 0
563+ test_vm .run ("true" , user = image_type .username , password = image_type .password )
565564 # root/ssh login also works
566- exit_status , output = test_vm .run ("id" , user = "root" , keyfile = image_type .ssh_keyfile_private_path )
567- assert exit_status == 0
568- assert "uid=0" in output
565+ ret = test_vm .run ("id" , user = "root" , keyfile = image_type .ssh_keyfile_private_path )
566+ assert "uid=0" in ret .stdout
569567 # check generic image options
570568 assert_kernel_args (test_vm , image_type )
571569 # ensure bootc points to the right image
572- _ , output = test_vm .run ("bootc status" , user = "root" , keyfile = image_type .ssh_keyfile_private_path )
570+ ret = test_vm .run ([ "bootc" , " status"] , user = "root" , keyfile = image_type .ssh_keyfile_private_path )
573571 # XXX: read the fully yaml instead?
574- assert f"image: { image_type .container_ref } " in output
572+ assert f"image: { image_type .container_ref } " in ret . stdout
575573
576574 if image_type .disk_config :
577575 assert_disk_customizations (image_type , test_vm )
578576 else :
579577 assert_fs_customizations (image_type , test_vm )
580578
581579 # check file/dir customizations
582- exit_status , output = test_vm .run ("stat /etc/some-file" , user = image_type .username , password = image_type .password )
583- assert exit_status == 0
584- assert "File: /etc/some-file" in output
585- _ , output = test_vm .run ("stat /etc/some-dir" , user = image_type .username , password = image_type .password )
586- assert exit_status == 0
587- assert "File: /etc/some-dir" in output
580+ ret = test_vm .run (["stat" , "/etc/some-file" ], user = image_type .username , password = image_type .password )
581+ assert "File: /etc/some-file" in ret .stdout
582+ ret = test_vm .run (["stat" , "/etc/some-dir" ], user = image_type .username , password = image_type .password )
583+ assert "File: /etc/some-dir" in ret .stdout
588584
589585
590586@pytest .mark .parametrize ("image_type" , gen_testcases ("ami-boot" ), indirect = ["image_type" ])
@@ -599,11 +595,9 @@ def test_ami_boots_in_aws(image_type, force_aws_upload):
599595 # 4.30 GiB / 10.00 GiB [------------>____________] 43.02% 58.04 MiB p/s
600596 assert "] 100.00%" in image_type .bib_output
601597 with AWS (image_type .metadata ["ami_id" ]) as test_vm :
602- exit_status , _ = test_vm .run ("true" , user = image_type .username , password = image_type .password )
603- assert exit_status == 0
604- exit_status , output = test_vm .run ("echo hello" , user = image_type .username , password = image_type .password )
605- assert exit_status == 0
606- assert "hello" in output
598+ test_vm .run ("true" , user = image_type .username , password = image_type .password )
599+ ret = test_vm .run (["echo" , "hello" ], user = image_type .username , password = image_type .password )
600+ assert "hello" in ret .stdout
607601
608602
609603def log_has_osbuild_selinux_denials (log ):
@@ -686,12 +680,11 @@ def assert_fs_customizations(image_type, test_vm):
686680 """
687681 # check the minsize specified in the build configuration for each mountpoint against the sizes in the image
688682 # TODO: replace 'df' call with 'parted --json' and find the partition size for each mountpoint
689- exit_status , output = test_vm .run ("df --all --output=target,size" , user = "root" ,
690- keyfile = image_type .ssh_keyfile_private_path )
691- assert exit_status == 0
683+ ret = test_vm .run (["df" , "--all" , "--output=target,size" ], user = "root" ,
684+ keyfile = image_type .ssh_keyfile_private_path )
692685 # parse the output of 'df' to a mountpoint -> size dict for convenience
693686 mountpoint_sizes = {}
694- for line in output .splitlines ()[1 :]:
687+ for line in ret . stdout .splitlines ()[1 :]:
695688 fields = line .split ()
696689 # some filesystems to not report a size with --all
697690 if fields [1 ] == "-" :
@@ -712,13 +705,12 @@ def assert_fs_customizations(image_type, test_vm):
712705
713706
714707def assert_disk_customizations (image_type , test_vm ):
715- exit_status , output = test_vm .run ("findmnt --json" , user = "root" ,
716- keyfile = image_type .ssh_keyfile_private_path )
717- assert exit_status == 0
718- findmnt = json .loads (output )
719- exit_status , swapon_output = test_vm .run ("swapon --show" , user = "root" ,
720- keyfile = image_type .ssh_keyfile_private_path )
721- assert exit_status == 0
708+ ret = test_vm .run (["findmnt" , "--json" ], user = "root" ,
709+ keyfile = image_type .ssh_keyfile_private_path )
710+ findmnt = json .loads (ret .stdout )
711+ swapon_ret = test_vm .run (["swapon" , "--show" ], user = "root" ,
712+ keyfile = image_type .ssh_keyfile_private_path )
713+ swapon_output = swapon_ret .stdout
722714 if dc := image_type .disk_config :
723715 if dc == "lvm" :
724716 mnts = [mnt for mnt in findmnt ["filesystems" ][0 ]["children" ]
0 commit comments