#184 Add 'with swap' tests, drop swap parts from other tests (#180)
Merged 3 years ago by adamwill. Opened 3 years ago by adamwill.

file modified
+25
@@ -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

@@ -19,7 +19,6 @@ 

      }

  

      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');

@@ -19,7 +19,6 @@ 

      }

  

      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";

@@ -23,7 +23,6 @@ 

      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

@@ -19,7 +19,6 @@ 

      }

  

      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";

tests/disk_custom_blivet_with_swap.pm tests/disk_custom_blivet_no_swap.pm
file renamed
+1 -2
@@ -19,11 +19,10 @@ 

      }

  

      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";

  

      # Anaconda hub

@@ -19,7 +19,6 @@ 

      }

  

      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";

tests/disk_custom_with_swap.pm tests/disk_custom_no_swap.pm
file renamed
+12 -5
@@ -1,6 +1,7 @@ 

  use base "anacondatest";

  use strict;

  use testapi;

+ use utils;

  use anaconda;

  

  sub run {
@@ -12,11 +13,17 @@ 

  

      # 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";

  

tests/disk_custom_with_swap_postinstall.pm tests/disk_custom_no_swap_postinstall.pm
file renamed
+4 -2
@@ -4,8 +4,10 @@ 

  

  sub run {

      assert_screen "root_console";

-     # check that swap is not used, check that "swapon --show has empty input"

-     assert_script_run '[[ ! $(swapon --show) ]]';

+     # 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 {

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 awilliam@redhat.com

rebased onto 49b11ec906bafe8e274710831a654f27dd1ed5c0

3 years ago

note: this isn't quite done yet, the postinstall command needs refining, but I need to see the output first to know what to look for :) testing this on my pet instance now.

Build failed.

rebased onto 2c8c262fc74992393a162dc35ccc4f26e3c8b7a7

3 years ago

Build failed.

rebased onto 0f1c7b0694af9163ca481df72081eab5e0dca4ab

3 years ago

Build succeeded.

rebased onto 232b224

3 years ago

Build succeeded.

This tested out fine on my pet instance, so merging it now.

Pull-Request has been merged by adamwill

3 years ago