From 68acecb6d480565fe45a3f72ccaea6bcde225903 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Thu, 10 Sep 2015 14:49:13 -0700 Subject: [PATCH] convert upgrade tests to dnf-plugin-system-upgrade Summary: This is a first cut which more or less works for now. Issues: 1) We're not really testing the BUILD, here. All the test does is try and upgrade to the specified VERSION - so it'll be using the latest 'stable' for the given VERSION at the time the test runs. This isn't really that terrible, but especially for TC/RC validation, we might want to make things a bit more elaborate and set up the repo for the actual BUILD (and disable the main repos). 2) We'd actually need --nogpgcheck for non-Rawhide, at one specific point in the release cycle - after Branching but before Bodhi activation (which is when we can be sure all packages are signed). This won't matter until 24 branches, and maybe releng will have it fixed by then...if not, I'll tweak it. 3) We don't really test that the upgrade actually *happened* for desktop, at the moment - the only thing in the old test that really checked that was where we checked for the fedup boot menu entry, but that has no analog in dnf. What we should probably do is check that GUI login works, then switch to a console and check /etc/fedora-release just as the minimal test does. Test Plan: Run the tests. Note that creating the desktop disk image doesn't work ATM, so I can't verify the desktop test works, but the minimal one seems to (with D565). There'll be a matching diff for openqa_fedora_tools to update the test case names there. Reviewers: jskladan, garretraziel Reviewed By: jskladan, garretraziel Subscribers: tflink Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D567 --- README.md | 3 ++ lib/installedtest.pm | 9 ++++++ main.pm | 6 ++-- needles/console_f22_installed.json | 18 ----------- needles/console_f22_installed.png | Bin 1386 -> 0 bytes needles/graphical_login_gdm_input.json | 43 +++++++++++-------------- needles/grub_fedup.json | 18 ----------- needles/grub_fedup.png | Bin 3535 -> 0 bytes templates | 16 ++++----- tests/upgrade_postinstall_desktop.pm | 3 ++ tests/upgrade_postinstall_minimal.pm | 5 ++- tests/upgrade_preinstall.pm | 6 ++-- tests/upgrade_run.pm | 32 +++++++----------- 13 files changed, 61 insertions(+), 98 deletions(-) delete mode 100644 needles/console_f22_installed.json delete mode 100644 needles/console_f22_installed.png delete mode 100644 needles/grub_fedup.json delete mode 100644 needles/grub_fedup.png diff --git a/README.md b/README.md index 201ccde8..ab86588b 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,9 @@ or in upgrade tests). It uploads `/var/log` in `post_fail_hook()`. It provides t and then calls `console_login()` for root. If you set `check` argument, it dies if it fails to log in. Example usage: running `$self->root_console(tty=>2, check=>0);` results in TTY2 displayed with root logged in. + - `check_release()` checks whether the installed release matches a given value. E.g. `check_release(23)` + checks whether the installed system is Fedora 23. The value can be 'Rawhide' or a Fedora release number; + often you will want to use `get_var('VERSION')`. Expects a console prompt to be active when it is called. ### New test development workflow diff --git a/lib/installedtest.pm b/lib/installedtest.pm index eb7b1842..0740e637 100644 --- a/lib/installedtest.pm +++ b/lib/installedtest.pm @@ -35,6 +35,15 @@ sub post_fail_hook { upload_logs "/tmp/var_log.tar.gz"; } +sub check_release { + my $self = shift; + my $release = shift; + type_string "clear\n"; + type_string "grep SUPPORT_PRODUCT_VERSION /usr/lib/os.release.d/os-release-fedora | grep -q ${release}\n"; + type_string "echo \$?\n"; + assert_screen "console_command_success"; +} + 1; # vim: set sw=4 et: diff --git a/main.pm b/main.pm index 612ed021..2b379bb1 100644 --- a/main.pm +++ b/main.pm @@ -57,9 +57,9 @@ if (get_var("ENTRYPOINT")) } elsif (get_var("UPGRADE")) { - # all upgrade tests consist of: preinstall phase (where packages are upgraded and fedup is - # installed), run phase (where fedup is run) and postinstall phase (where is checked if - # fedora was upgraded successfully) + # all upgrade tests consist of: preinstall phase (where packages are upgraded and + # dnf-plugin-system-upgrade is installed), run phase (where upgrade is run) and postinstall + # phase (where is checked if fedora was upgraded successfully) autotest::loadtest get_var('CASEDIR')."/tests/upgrade_preinstall.pm"; autotest::loadtest get_var('CASEDIR')."/tests/upgrade_run.pm"; # UPGRADE can be set to "minimal", "encrypted", "desktop"... diff --git a/needles/console_f22_installed.json b/needles/console_f22_installed.json deleted file mode 100644 index c42b9ba5..00000000 --- a/needles/console_f22_installed.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "properties": [], - "area": [ - { - "xpos": 0, - "ypos": 129, - "width": 238, - "height": 12, - "type": "match" - } - ], - "tags": [ - "console_f22_installed", - "ENV-DISTRI-fedora", - "ENV-INSTLANG-en_US", - "ENV-FLAVOR-develop" - ] -} \ No newline at end of file diff --git a/needles/console_f22_installed.png b/needles/console_f22_installed.png deleted file mode 100644 index 2442ad018a268419dd3c6f743d9b92e50291424e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1386 zcmchV=~og66vbIWNptDs=tw0~#!1U`Y)sRWKqxvoxh6{EhAECpmb>JFSZ={Wu3!KVtOPYK+f@k__bXmlB^w$Vjs&Nz0ss)Wll^5cvT$v@>*kz;UY1nP81M3U zT?f+?bmlU|EDL()vYH?x7i`EW;_0Ki>vQ-(^*pa8+&NEZoZ5b@rThi$RADM5DkzCV z_9oFpKN%bZ0A{kS!jtzy%$#C;k{+;&rk-}9(H>mN^ zXq_mX-}Uaq8L@qup~g1x<9pNX0r+6P2KIrY^w@V_#9mMBGL56TcT+I9y=>Y8`Yj93qPePs;P89C2WiehOArPO-* z8;hmN7yL4AMXM0n%QRY#>H6FHADP-l+u2e2MvYZDR~X*{#d_-G&r{5O(H*K8n3^U* z(!S#~Sl9t(oDFi;)jhv*@~{3r>Uic_g84w?_QK*v7RAzPEU!AXVpU|SxE5fcGif@U zu-CFIdpTSH{rt#JlJl(^w^tEs3c95b^;%Ym0ADGN_bjyqtw#Vk8AR}emVg%+f?Rd0 zDcK_qQFB7<>`QyYu&|S*sSpPDzQ_Pb+@TIRufl7!Msdnz`;P zu`(>=9A+cPBFbwxz%%2^W04N7IL3Pr{zEyk`5YuLr4XBVsK z7yq0X4+`E!}UDX&U4z5f$d`&oztKQLsH|xJP4>?dD7ce?29w8_zXrECr|%YPdJ&T zlB=bLBH4&~=f?^dYhQYQ3)CLz%bX3=-F}-cRj8OqVn=4@Dto#lm0(3Ui*lNNDTeYhvIr51M?&Aa5EXo#3LHRNp`7crv4k%mvvr3j#W%a4^#G;1vt!-4) zRAEtf0TPaXzbH%p4$LNZpO&Q)!N_tglcSP1DTEJHw*~NkYKj#ce`#iKr@KXc=(G%| etm^+f1gA7`knAulQqdLu&Dsg;YTtw*-1!eKM|ipb diff --git a/needles/graphical_login_gdm_input.json b/needles/graphical_login_gdm_input.json index becff622..67d95dbe 100644 --- a/needles/graphical_login_gdm_input.json +++ b/needles/graphical_login_gdm_input.json @@ -1,25 +1,18 @@ -{ - "area": [ - { - "xpos": 341, - "ypos": 372, - "width": 343, - "height": 65, - "type": "match" - }, - { - "xpos": 600, - "ypos": 470, - "width": 80, - "height": 30, - "type": "match" - } - ], - "tags": [ - "graphical_login_input", - "ENV-DISTRI-fedora", - "ENV-INSTLANG-en_US", - "ENV-FLAVOR-develop" - ], - "properties": [] -} +{ + "area": [ + { + "height": 65, + "type": "match", + "width": 343, + "xpos": 341, + "ypos": 372 + } + ], + "properties": [], + "tags": [ + "graphical_login_input", + "ENV-DISTRI-fedora", + "ENV-INSTLANG-en_US", + "ENV-FLAVOR-develop" + ] +} \ No newline at end of file diff --git a/needles/grub_fedup.json b/needles/grub_fedup.json deleted file mode 100644 index ba85f34a..00000000 --- a/needles/grub_fedup.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "properties": [], - "area": [ - { - "xpos": 119, - "ypos": 51, - "width": 61, - "height": 10, - "type": "match" - } - ], - "tags": [ - "grub_fedup", - "ENV-DISTRI-fedora", - "ENV-INSTLANG-en_US", - "ENV-FLAVOR-server" - ] -} \ No newline at end of file diff --git a/needles/grub_fedup.png b/needles/grub_fedup.png deleted file mode 100644 index e5d87a2aa59d99df778eea2002202a1696e69963..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3535 zcmeHJ`#0P97X5saA#H}5&d^R(=@fVB*)gqpq#{#VLhJn|xW#Q5G(u29Vurq^R8z$5 zl<0Uzq9_#vnR-hxZAldIYBiO3q|{sLn*U(d{B+k{_x!TY5Br>T)?RDxb#6I1*eD`Z zkpKWitgW>R0H5u)Z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zjj$Rf*Z{g`+ zXZ3Ti83LN+*LUjolJ(`;(~UyC>^k$r`K2OfqvrW6iCtj2y{FGsuhXto#>F40;Uo8O zXj!)hExXPqM>nAUb$gb+u{a8J65BL%>os{QdNz;ot>Z?M42iO-sO9w6E*sdoFnP(b zLcOsjeVlH6EeGb+XwRpenKC+$xs&~9&Fz|oj^Iih)OK0=REzWe7P#a>s=NY*4e9Ny~RE{Pqxir)1+{K+WqcGrhpfK zknSADtT=(IL73D3l(+_Db+HS+&i|K$pBt<-nmGn%PSkLJbn{&_3* MoP%}c*}$Lv10-Qh^8f$< diff --git a/templates b/templates index f7d9dbc9..38743629 100755 --- a/templates +++ b/templates @@ -224,7 +224,7 @@ flavor => "universal", version => "*", }, - test_suite => { name => "fedup_minimal_64bit" }, + test_suite => { name => "upgrade_minimal_64bit" }, }, { machine => { name => "64bit" }, @@ -234,7 +234,7 @@ flavor => "universal", version => "*", }, - test_suite => { name => "fedup_desktop_64bit" }, + test_suite => { name => "upgrade_desktop_64bit" }, }, { machine => { name => "64bit" }, @@ -484,7 +484,7 @@ flavor => "universal", version => "*", }, - test_suite => { name => "fedup_minimal_32bit" }, + test_suite => { name => "upgrade_minimal_32bit" }, }, { machine => { name => "32bit" }, @@ -494,7 +494,7 @@ flavor => "universal", version => "*", }, - test_suite => { name => "fedup_desktop_32bit" }, + test_suite => { name => "upgrade_desktop_32bit" }, }, { machine => { name => "32bit" }, @@ -801,7 +801,7 @@ variables => "", }, { - name => "fedup_minimal_64bit", + name => "upgrade_minimal_64bit", prio => 19, settings => [ { key => "ROOT_PASSWORD", value => "weakpassword" }, @@ -812,7 +812,7 @@ variables => "", }, { - name => "fedup_desktop_64bit", + name => "upgrade_desktop_64bit", prio => 20, settings => [ { key => "ROOT_PASSWORD", value => "weakpassword" }, @@ -823,7 +823,7 @@ variables => "", }, { - name => "fedup_minimal_32bit", + name => "upgrade_minimal_32bit", prio => 19, settings => [ { key => "ROOT_PASSWORD", value => "weakpassword" }, @@ -834,7 +834,7 @@ variables => "", }, { - name => "fedup_desktop_32bit", + name => "upgrade_desktop_32bit", prio => 20, settings => [ { key => "ROOT_PASSWORD", value => "weakpassword" }, diff --git a/tests/upgrade_postinstall_desktop.pm b/tests/upgrade_postinstall_desktop.pm index 26e0d5d1..0cf6d737 100644 --- a/tests/upgrade_postinstall_desktop.pm +++ b/tests/upgrade_postinstall_desktop.pm @@ -17,6 +17,9 @@ sub run { send_key "ret"; # wait until desktop appears assert_screen "graphical_desktop_clean", 30; + # check an upgrade actually happened (and we can log into a console) + $self->root_console(tty=>3); + $self->check_release(get_var('VERSION')); } diff --git a/tests/upgrade_postinstall_minimal.pm b/tests/upgrade_postinstall_minimal.pm index abbf0a68..9f59761e 100644 --- a/tests/upgrade_postinstall_minimal.pm +++ b/tests/upgrade_postinstall_minimal.pm @@ -6,11 +6,10 @@ use testapi; sub run { my $self = shift; - # try to login, check whether F22 is installed + # try to login, check whether target release is installed $self->boot_to_login_screen(); $self->root_console(tty=>3); - - assert_screen "console_f22_installed"; + $self->check_release(get_var('VERSION')); } diff --git a/tests/upgrade_preinstall.pm b/tests/upgrade_preinstall.pm index 162d9633..c93ace9a 100644 --- a/tests/upgrade_preinstall.pm +++ b/tests/upgrade_preinstall.pm @@ -14,9 +14,9 @@ sub run { # switch to TTY3 for both, graphical and console tests $self->root_console(tty=>3); - # fedup should be installed on up-to-date system + # upgrader should be installed on up-to-date system - type_string 'yum -y update; echo $?'; + type_string 'dnf -y update; echo $?'; send_key "ret"; assert_screen "console_command_success", 1800; @@ -31,7 +31,7 @@ sub run { } $self->root_console(tty=>3); - type_string 'yum -y install fedup; echo $?'; + type_string 'dnf -y --enablerepo=updates-testing install dnf-plugin-system-upgrade; echo $?'; send_key "ret"; assert_screen "console_command_success", 1800; diff --git a/tests/upgrade_run.pm b/tests/upgrade_run.pm index fb3c6e1a..3d2e28c0 100644 --- a/tests/upgrade_run.pm +++ b/tests/upgrade_run.pm @@ -3,32 +3,24 @@ use strict; use testapi; sub run { - my $fedup_url; - my $to_version; - # FIXME: this is just a workaround, see https://phab.qadevel.cloud.fedoraproject.org/T478 - # construct download URL - if (get_var("BUILD") =~ /^(\d+)_Final_(.*)$/) { - $fedup_url = "https://dl.fedoraproject.org/pub/alt/stage/".$1."_".$2."/Server/".get_var("ARCH")."/os"; - $to_version = $1; - } else { - $fedup_url = "https://dl.fedoraproject.org/pub/alt/stage/".get_var("BUILD")."/Server/".get_var("ARCH")."/os"; - get_var("BUILD") =~ /^(\d+)/; - $to_version = $1; + my $release = lc(get_var('VERSION')); + my $milestone = lc((split /_/, get_var("BUILD"))[1]); + my $args = "--releasever=${release}"; + # This is excessive - after the Bodhi activation point we don't + # need --nogpgcheck for Branched. But that's hard to detect magically + if ($release eq 'rawhide' or $milestone eq 'branched') { + $args .= " --nogpgcheck"; } - - type_string "fedup --network ".$to_version." --instrepo ".$fedup_url; + type_string "dnf -y system-upgrade download ${args}"; send_key "ret"; - # wait untill fedup finishes its work (screen stops moving for 30 seconds) + # wait until dnf finishes its work (screen stops moving for 30 seconds) wait_still_screen 30, 6000; # TODO: shorter timeout, longer stillscreen? - upload_logs "/var/log/fedup.log"; + upload_logs "/var/log/dnf.log"; + upload_logs "/var/log/dnf.rpm.log"; - type_string "reboot"; - send_key "ret"; - - # check that "upgrade" item is shown in GRUB - assert_screen "grub_fedup", 30; + type_string "dnf system-upgrade reboot"; send_key "ret"; # now offline upgrading starts. user doesn't have to do anything, just wait untill