From d1006a38e5f043df448a5c1b7ec7a29e2e70cd53 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Fri, 25 Jan 2019 14:41:32 +0100 Subject: [PATCH] Have update installer test install the update packages (#89) In https://bugzilla.redhat.com/show_bug.cgi?id=1669256 it became obvious that there's a missing feature in the new installer test for updates: the update is both used in the image build process and built into the installer environment itself, but it is not actually included in the installed package set. This can be a problem if the update has a bug that manifests *only* at install time if it is in the install transaction (which is exactly the case there), because the test will not catch this, and nor will any other test. So this commit makes `support_server` set up the update repo and serve it out via NFS when it's run in an update context, and makes the actual update install test run parallel with it and use that repository. This way the install should include the package(s) from the update. (It also of course means the test fails if an update breaks NFS or something like that, but hey, we want to know that!) A parallel commit for fedora_openqa is necessary to add the required CURRREL setting for the updates-installer flavor. Signed-off-by: Adam Williamson --- main.pm | 2 +- templates-updates | 17 +++++++++++++++++ tests/_boot_to_anaconda.pm | 5 +++++ tests/_check_install_source.pm | 34 +++++++++++++++++++++++---------- tests/_support_server.pm | 35 +++++++++++++++++++++------------- 5 files changed, 69 insertions(+), 24 deletions(-) diff --git a/main.pm b/main.pm index 96294559..15e0e0d5 100644 --- a/main.pm +++ b/main.pm @@ -169,7 +169,7 @@ sub load_install_tests() { autotest::loadtest "tests/install_source_graphical.pm"; autotest::loadtest "tests/_check_install_source.pm"; } - if (get_var("REPOSITORY_VARIATION")){ + if (get_var("REPOSITORY_VARIATION") || get_var("ADD_REPOSITORY_VARIATION")) { autotest::loadtest "tests/_check_install_source.pm"; } diff --git a/templates-updates b/templates-updates index 3e7b6d9d..84164715 100755 --- a/templates-updates +++ b/templates-updates @@ -378,6 +378,18 @@ }, test_suite => { name => "installer_build" }, }, + { + group_name => "Fedora Updates", + machine => { name => "64bit" }, + prio => 40, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "updates-installer", + version => "*", + }, + test_suite => { name => "support_server" }, + }, { group_name => "Fedora Updates", machine => { name => "64bit" }, @@ -984,9 +996,14 @@ name => "install_default_update", settings => [ { key => "INSTALL", value => "1" }, + { key => "INSTALL_UNLOCK", value => "support_ready" }, { key => "ISO", value => "%ADVISORY%-netinst-%ARCH%.iso" }, + { key => "NICTYPE", value => "tap" }, { key => "PACKAGE_SET", value => "default" }, + { key => "PARALLEL_WITH", value => "support_server" }, + { key => "ADD_REPOSITORY_VARIATION", value => "nfs://10.0.2.110:/opt/update_repo" }, { key => "+START_AFTER_TEST", value => "installer_build" }, + { key => "WORKER_CLASS", value => "tap" }, ], }, ], diff --git a/tests/_boot_to_anaconda.pm b/tests/_boot_to_anaconda.pm index 92cdc7ba..4e3827c3 100644 --- a/tests/_boot_to_anaconda.pm +++ b/tests/_boot_to_anaconda.pm @@ -18,6 +18,11 @@ sub run { if ($repourl) { $params .= "inst.repo=" . get_full_repo($repourl) . " "; } + # Construct inst.addrepo arg for ADD_REPOSITORY_VARIATION + my $repourl = get_var("ADD_REPOSITORY_VARIATION"); + if ($repourl) { + $params .= "inst.addrepo=addrepo," . get_full_repo($repourl) . " "; + } if (get_var("ANACONDA_TEXT")) { $params .= "inst.text "; } diff --git a/tests/_check_install_source.pm b/tests/_check_install_source.pm index 7b811a7c..0cb22f8a 100644 --- a/tests/_check_install_source.pm +++ b/tests/_check_install_source.pm @@ -6,30 +6,37 @@ use anaconda; sub run { my $self = shift; my $repourl; + my $addrepourl; if (get_var("MIRRORLIST_GRAPHICAL")) { $repourl = get_mirrorlist_url(); } else { $repourl = get_var("REPOSITORY_VARIATION", get_var("REPOSITORY_GRAPHICAL")); - $repourl = get_full_repo($repourl); + $repourl = get_full_repo($repourl) if ($repourl); + $addrepourl = get_var("ADD_REPOSITORY_VARIATION"); + $addrepourl = get_full_repo($addrepourl) if ($addrepourl); } # check that the repo was used $self->root_console; + if ($addrepourl) { + if ($addrepourl =~ m,^nfs://,,) { + # this line tells us it set up a repo for our URL... + assert_script_run 'grep "repo addrepo.*' . ${addrepourl} . '" /tmp/packaging.log'; + # ...this line tells us it added the repo called 'addrepo'... + assert_script_run 'grep "\(added\|enabled\) repo: .addrepo." /tmp/packaging.log'; + # ...and this line tells us it worked (I hope) + assert_script_run 'grep "enabled repo.*nfs" /tmp/packaging.log'; + } + } if ($repourl =~ s/^nfs://) { $repourl =~ s/^nfsvers=.://; # the above both checks if we're dealing with an NFS URL, and # strips the 'nfs:' and 'nfsvers=.:' from it if so - if (get_var("OFW")) { - # for PowerPC mounting info may be not in anaconda.log - assert_script_run "mount |grep nfs |grep '${repourl}'"; - } - else { - # message is in packaging.log up to F26, anaconda.log F27+ - assert_script_run "grep 'mounting ${repourl}' /tmp/packaging.log /tmp/anaconda.log"; - } + # check the repo was actually mounted + assert_script_run "mount |grep nfs |grep '${repourl}'"; } - else { + elsif ($repourl) { # there are only three hard problems in software development: # naming things, cache expiry, off-by-one errors...and quoting # we need single quotes (at the perl level) around the start @@ -48,6 +55,13 @@ sub run { # is done. assert_script_run 'grep "\(added\|enabled\) repo: ' . "\\('anaconda'\\|''\\).*${repourl}" . '" /tmp/packaging.log'; } + if ($repourl) { + # check we don't have an error indicating our repo wasn't used + assert_script_run '! grep "base repo.*not valid" /tmp/packaging.log'; + } + # just for convenience - sometimes it's useful to see this log + # for a success case + upload_logs "/tmp/packaging.log", failok=>1; send_key "ctrl-alt-f6"; # Anaconda hub diff --git a/tests/_support_server.pm b/tests/_support_server.pm index e62f3e26..36bd6594 100644 --- a/tests/_support_server.pm +++ b/tests/_support_server.pm @@ -4,6 +4,7 @@ use testapi; use lockapi; use mmapi; use tapnet; +use utils; sub run { my $self=shift; @@ -32,19 +33,27 @@ sub run { assert_script_run "mkdir -p /export"; # get the kickstart assert_script_run "curl -o /export/root-user-crypted-net.ks https://jskladan.fedorapeople.org/kickstarts/root-user-crypted-net.ks"; - # create the repo share - assert_script_run "mkdir -p /repo"; - # create a mount point for the ISO - assert_script_run "mkdir -p /mnt/iso"; - # mount the ISO there - assert_script_run "mount /dev/cdrom /mnt/iso"; - # copy the contents of the ISO to the repo share - assert_script_run "cp -R /mnt/iso/* /repo", 180; - # put the updates image in the NFS repo (for testing this update - # image delivery method) - assert_script_run "curl -o /repo/images/updates.img https://fedorapeople.org/groups/qa/updates/updates-openqa.img"; - # set up the exports - assert_script_run "printf '/export 10.0.2.0/24(ro)\n/repo 10.0.2.0/24(ro)' > /etc/exports"; + # for update tests, set up the update repository and export it + if (get_var("ADVISORY")) { + assert_script_run "echo '/opt/update_repo 10.0.2.0/24(ro)' >> /etc/exports"; + } + # for compose tests, we do all this stuff + else { + # create the repo share + assert_script_run "mkdir -p /repo"; + # create a mount point for the ISO + assert_script_run "mkdir -p /mnt/iso"; + # mount the ISO there + assert_script_run "mount /dev/cdrom /mnt/iso"; + # copy the contents of the ISO to the repo share + assert_script_run "cp -R /mnt/iso/* /repo", 180; + # put the updates image in the NFS repo (for testing this update + # image delivery method) + assert_script_run "curl -o /repo/images/updates.img https://fedorapeople.org/groups/qa/updates/updates-openqa.img"; + # set up the exports + assert_script_run "printf '/export 10.0.2.0/24(ro)\n/repo 10.0.2.0/24(ro)' > /etc/exports"; + } + # open firewall port assert_script_run "firewall-cmd --add-service=nfs"; # start the server