From 232b224d22475f65fb7885e3f0bd6d3c80fc3d0f Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Tue, 11 Aug 2020 13:34:37 -0700 Subject: [PATCH] Add 'with swap' tests, drop swap parts from other tests (#180) In Fedora 33, we generally no longer include a disk-based swap partition by default (instead swap-on-ZRAM is used, see https://fedoraproject.org/wiki/Changes/SwapOnZRAM ). This tweaks our tests to account for that. In tests that aren't to do with swap at all, we stop including a swap partition in order to be closer to the default layout. We replace the old _no_swap blivet and custom tests with _with_swap tests that, as the name implies, *explicitly include* a swap partition, and adjust the postinstall test to check the disk swap partition is there. Signed-off-by: Adam Williamson --- templates.fif.json | 25 +++++++++++++++++++ tests/disk_custom_blivet_btrfs.pm | 1 - tests/disk_custom_blivet_ext3.pm | 1 - tests/disk_custom_blivet_lvmthin.pm | 1 - tests/disk_custom_blivet_software_raid.pm | 1 - ...wap.pm => disk_custom_blivet_with_swap.pm} | 3 +-- tests/disk_custom_blivet_xfs.pm | 1 - tests/disk_custom_no_swap_postinstall.pm | 17 ------------- ...om_no_swap.pm => disk_custom_with_swap.pm} | 17 +++++++++---- tests/disk_custom_with_swap_postinstall.pm | 19 ++++++++++++++ 10 files changed, 57 insertions(+), 29 deletions(-) rename tests/{disk_custom_blivet_no_swap.pm => disk_custom_blivet_with_swap.pm} (88%) delete mode 100644 tests/disk_custom_no_swap_postinstall.pm rename tests/{disk_custom_no_swap.pm => disk_custom_with_swap.pm} (60%) create mode 100644 tests/disk_custom_with_swap_postinstall.pm diff --git a/templates.fif.json b/templates.fif.json index 0eeb46cb..10fb53b7 100644 --- a/templates.fif.json +++ b/templates.fif.json @@ -892,6 +892,19 @@ "ROOT_PASSWORD": "weakpassword" } }, + "install_blivet_with_swap": { + "profiles": { + "fedora-universal-aarch64-*-aarch64": 50, + "fedora-universal-ppc64le-*-ppc64le": 50, + "fedora-universal-x86_64-*-64bit": 50, + "fedora-universal-x86_64-*-uefi": 51 + }, + "settings": { + "PARTITIONING": "custom_blivet_with_swap", + "POSTINSTALL": "disk_custom_with_swap_postinstall", + "ROOT_PASSWORD": "weakpassword" + } + }, "install_blivet_software_raid": { "profiles": { "fedora-universal-aarch64-*-aarch64": 40, @@ -1186,6 +1199,18 @@ "ROOT_PASSWORD": "weakpassword" } }, + "install_with_swap": { + "profiles": { + "fedora-universal-aarch64-*-aarch64": 50, + "fedora-universal-ppc64le-*-ppc64le": 50, + "fedora-universal-x86_64-*-64bit": 50, + "fedora-universal-x86_64-*-uefi": 51 + }, + "settings": { + "PARTITIONING": "custom_with_swap", + "ROOT_PASSWORD": "weakpassword" + } + }, "install_no_user": { "profiles": { "fedora-KDE-live-iso-x86_64-*-64bit": 21 diff --git a/tests/disk_custom_blivet_btrfs.pm b/tests/disk_custom_blivet_btrfs.pm index ccedded4..8e6a570f 100644 --- a/tests/disk_custom_blivet_btrfs.pm +++ b/tests/disk_custom_blivet_btrfs.pm @@ -19,7 +19,6 @@ sub run { } custom_blivet_add_partition(size => 512, mountpoint => '/boot'); - custom_blivet_add_partition(size => 2048, filesystem => 'swap'); # selecting "btrfs" as filesystem creates new BTRFS drive in blivet-gui custom_blivet_add_partition(filesystem => 'btrfs'); diff --git a/tests/disk_custom_blivet_ext3.pm b/tests/disk_custom_blivet_ext3.pm index 0cf8048b..a671853f 100644 --- a/tests/disk_custom_blivet_ext3.pm +++ b/tests/disk_custom_blivet_ext3.pm @@ -19,7 +19,6 @@ sub run { } custom_blivet_add_partition(size => 512, mountpoint => '/boot'); - custom_blivet_add_partition(size => 2048, filesystem => 'swap'); custom_blivet_add_partition(filesystem => 'ext3', mountpoint => '/'); assert_and_click "anaconda_spoke_done"; diff --git a/tests/disk_custom_blivet_lvmthin.pm b/tests/disk_custom_blivet_lvmthin.pm index 08991244..d8c6be1f 100644 --- a/tests/disk_custom_blivet_lvmthin.pm +++ b/tests/disk_custom_blivet_lvmthin.pm @@ -23,7 +23,6 @@ sub run { custom_blivet_add_partition(devicetype => 'lvm'); # select newly created LVM device for adding new partition assert_and_click "anaconda_blivet_volumes_icon"; - custom_blivet_add_partition(size => 2048, filesystem => 'swap'); # add lvmthinpool custom_blivet_add_partition(devicetype => 'lvmthin'); # select lvmthinpool for adding new partitions diff --git a/tests/disk_custom_blivet_software_raid.pm b/tests/disk_custom_blivet_software_raid.pm index 88bf4918..278c5119 100644 --- a/tests/disk_custom_blivet_software_raid.pm +++ b/tests/disk_custom_blivet_software_raid.pm @@ -19,7 +19,6 @@ sub run { } custom_blivet_add_partition(size => 512, mountpoint => '/boot'); - custom_blivet_add_partition(size => 2048, filesystem => 'swap'); custom_blivet_add_partition(raid1 => 1, mountpoint => '/'); assert_and_click "anaconda_spoke_done"; diff --git a/tests/disk_custom_blivet_no_swap.pm b/tests/disk_custom_blivet_with_swap.pm similarity index 88% rename from tests/disk_custom_blivet_no_swap.pm rename to tests/disk_custom_blivet_with_swap.pm index eaa6af72..4caf2fb5 100644 --- a/tests/disk_custom_blivet_no_swap.pm +++ b/tests/disk_custom_blivet_with_swap.pm @@ -19,10 +19,9 @@ sub run { } custom_blivet_add_partition(size => 512, mountpoint => '/boot'); + custom_blivet_add_partition(size => 2048, filesystem => 'swap'); custom_blivet_add_partition(mountpoint => '/'); - assert_and_click "anaconda_spoke_done"; - # click "done" second time, because it warns us about missing swap partition assert_and_click "anaconda_spoke_done"; assert_and_click "anaconda_part_accept_changes"; diff --git a/tests/disk_custom_blivet_xfs.pm b/tests/disk_custom_blivet_xfs.pm index 723f395b..ae4831c5 100644 --- a/tests/disk_custom_blivet_xfs.pm +++ b/tests/disk_custom_blivet_xfs.pm @@ -19,7 +19,6 @@ sub run { } custom_blivet_add_partition(size => 512, mountpoint => '/boot'); - custom_blivet_add_partition(size => 2048, filesystem => 'swap'); custom_blivet_add_partition(filesystem => 'xfs', mountpoint => '/'); assert_and_click "anaconda_spoke_done"; diff --git a/tests/disk_custom_no_swap_postinstall.pm b/tests/disk_custom_no_swap_postinstall.pm deleted file mode 100644 index 6cdd75e1..00000000 --- a/tests/disk_custom_no_swap_postinstall.pm +++ /dev/null @@ -1,17 +0,0 @@ -use base "installedtest"; -use strict; -use testapi; - -sub run { - assert_screen "root_console"; - # check that swap is not used, check that "swapon --show has empty input" - assert_script_run '[[ ! $(swapon --show) ]]'; -} - -sub test_flags { - return { fatal => 1 }; -} - -1; - -# vim: set sw=4 et: diff --git a/tests/disk_custom_no_swap.pm b/tests/disk_custom_with_swap.pm similarity index 60% rename from tests/disk_custom_no_swap.pm rename to tests/disk_custom_with_swap.pm index 203c424b..509f2c96 100644 --- a/tests/disk_custom_no_swap.pm +++ b/tests/disk_custom_with_swap.pm @@ -1,6 +1,7 @@ use base "anacondatest"; use strict; use testapi; +use utils; use anaconda; sub run { @@ -12,11 +13,17 @@ sub run { # Manual partitioning spoke should be displayed assert_and_click "anaconda_part_automatic"; - custom_delete_part('swap'); - assert_and_click "anaconda_spoke_done"; - # Deleting swap shows a warning and requires a second click to confirm - # Wait a sec first, otherwise sometimes we click too fast - sleep 1; + # Make / smaller + send_key_until_needlematch("anaconda_part_mountpoint_selected", "tab", 20); + # One tab on from 'mount point selected' is 'size' + send_key "tab"; + type_very_safely "8 GiB"; + assert_and_click "anaconda_part_update_settings"; + # Add swap + assert_and_click "anaconda_part_add"; + type_very_safely "swap"; + send_key "tab"; + assert_and_click "anaconda_part_add_mountpoint"; assert_and_click "anaconda_spoke_done"; assert_and_click "anaconda_part_accept_changes"; diff --git a/tests/disk_custom_with_swap_postinstall.pm b/tests/disk_custom_with_swap_postinstall.pm new file mode 100644 index 00000000..46994d90 --- /dev/null +++ b/tests/disk_custom_with_swap_postinstall.pm @@ -0,0 +1,19 @@ +use base "installedtest"; +use strict; +use testapi; + +sub run { + assert_screen "root_console"; + # this is basically asserting that if we list all swaps and grep + # out any zram ones, we still have one at prio -2, which should + # be the disk-based one + assert_script_run 'swapon --show | grep -v zram | grep "\-2"'; +} + +sub test_flags { + return { fatal => 1 }; +} + +1; + +# vim: set sw=4 et: