From 7932662e9949f98c5b59b4a61f4e3fc17f5836fd Mon Sep 17 00:00:00 2001 From: Zaoliang Luo Date: Thu, 10 Sep 2020 12:50:09 +0200 Subject: [PATCH] Add test boot_into_snapshot_after_upgrade and roll_back_after_upgrade See https://progress.opensuse.org/issues/12964 Introduce BOOT_INTO_SNAPSHOT_AFTER_UPGRADE and ROLL_BACK_AFTER_UPGRADE in lib/bootloader_setup.pm at function BOOT_INTO_SNAPSHOT Verifications: http://10.162.23.47/tests/8142 (Boot_into_snapshot_after_upgrade) http://10.162.23.47/tests/8143 (Roll_back_after_upgrade) Needles PR: https://github.com/os-autoinst/os-autoinst-needles-opensuse/pull/690 --- lib/bootloader_setup.pm | 56 ++++++++++++++++--- .../boot_into_snapshot_after_upgrade.yaml | 19 +++++++ 2 files changed, 66 insertions(+), 9 deletions(-) create mode 100644 schedule/functional/boot_into_snapshot_after_upgrade.yaml diff --git a/lib/bootloader_setup.pm b/lib/bootloader_setup.pm index 33507fca6a8f..c3e6aa403ad7 100644 --- a/lib/bootloader_setup.pm +++ b/lib/bootloader_setup.pm @@ -18,7 +18,7 @@ use Mojo::Util 'trim'; use Time::HiRes 'sleep'; use testapi; use utils; -use version_utils qw(is_caasp is_jeos is_leap is_sle is_tumbleweed); +use version_utils qw(is_caasp is_jeos is_leap is_sle is_tumbleweed is_opensuse); use mm_network; use Utils::Backends 'is_pvm'; @@ -262,20 +262,58 @@ sub boot_local_disk { sub boot_into_snapshot { send_key_until_needlematch('boot-menu-snapshot', 'down', 10, 5); send_key 'ret'; + # BOOT_INTO_SNAPSHOT_AFTER_UPGRADE - boot into tumbleweed default. + if (get_var('BOOT_INTO_SNAPSHOT_AFTER_UPGRADE') && is_opensuse) { + send_key_until_needlematch('snap-after-update', 'down', 10, 5); + send_key 'ret'; + send_key_until_needlematch('advanced-options-tumbleweed', 'down', 10, 5); + send_key 'ret'; + send_key_until_needlematch('boot-tumbleweed-default', 'down', 10, 5); + send_key 'ret'; + assert_screen 'opensuse-welcome', 120; + } + # ROLL_BACK_AFTER_UPGRADE - boot into leap before upgradde + elsif (get_var('ROLL_BACK_AFTER_UPGRADE') && is_opensuse) { + send_key_until_needlematch('snap-before-update', 'down', 10, 5); + send_key 'ret'; + send_key_until_needlematch('advanced-options-leap', 'down', 10, 5); + send_key 'ret'; + send_key_until_needlematch('boot-leap-default', 'down', 10, 5); + send_key 'ret'; + assert_screen 'generic-desktop', 120; + } # assert needle to avoid send down key early in grub_test_snapshot. - assert_screen('snap-default', 120) if (get_var('OFW') || is_pvm); + elsif (get_var('OFW') || is_pvm) { + assert_screen('snap-default', 120); + save_screenshot; + send_key 'ret'; + # avoid timeout for booting to HDD + save_screenshot; + send_key 'ret'; + } # in upgrade/migration scenario, we want to boot from snapshot 1 before migration. - if ((get_var('UPGRADE') && !get_var('ONLINE_MIGRATION', 0)) || get_var('ZDUP')) { + elsif ((get_var('UPGRADE') && !get_var('ONLINE_MIGRATION', 0)) || get_var('ZDUP')) { send_key_until_needlematch('snap-before-update', 'down', 40, 5); save_screenshot; + send_key 'ret'; + # avoid timeout for booting to HDD + save_screenshot; + send_key 'ret'; } # in an online migration - send_key_until_needlematch('snap-before-migration', 'down', 40, 5) if (get_var('ONLINE_MIGRATION')); - save_screenshot; - send_key 'ret'; - # avoid timeout for booting to HDD - save_screenshot; - send_key 'ret'; + elsif (get_var('ONLINE_MIGRATION')) { + send_key_until_needlematch('snap-before-migration', 'down', 40, 5); + save_screenshot; + send_key 'ret'; + # avoid timeout for booting to HDD + save_screenshot; + send_key 'ret'; + } + else { + # avoid timeout for booting to HDD + save_screenshot; + send_key 'ret'; + } } sub select_bootmenu_option { diff --git a/schedule/functional/boot_into_snapshot_after_upgrade.yaml b/schedule/functional/boot_into_snapshot_after_upgrade.yaml new file mode 100644 index 000000000000..9fbdd1de4378 --- /dev/null +++ b/schedule/functional/boot_into_snapshot_after_upgrade.yaml @@ -0,0 +1,19 @@ +--- +name: boot_into_snapshot_after_upgrade +description: > + Maintainer: zluo + Boot into snapshoot after upgrade from DVD-Live installation +schedule: + - installation/isosize + - installation/bootloader + - installation/welcome + - installation/upgrade_select + - installation/online_repos + - installation/resolve_dependency_issues + - installation/installation_overview + - installation/disable_grub_timeout + - installation/start_install + - installation/await_install + - installation/logs_from_installation_system + - installation/reboot_after_installation + - installation/grub_test