os-autoinst-distri-rocky-mi.../tests/_check_install_source.pm
Adam Williamson d1006a38e5 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 <awilliam@redhat.com>
2019-01-26 19:14:04 +01:00

79 lines
3.0 KiB
Perl

use base "anacondatest";
use strict;
use testapi;
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) 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
# check the repo was actually mounted
assert_script_run "mount |grep nfs |grep '${repourl}'";
}
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
# of this, so the backslashes are not interpreted by perl but
# passed through to ultimately be interpreted by 'grep'
# itself. We need double quotes around $repourl so that *is*
# interpreted by perl. And we need quotes around the entire
# expression at the bash level, and single quotes around the
# text 'anaconda' at the level of grep, as the string we're
# actually matching on literally has 'anaconda' in it. We need
# (added|enabled) till F28 goes EOL: the log line was changed
# in Rawhide after F28 came out. ('anaconda'|'') is a work
# around for an anaconda bug that only appears in F29-era
# Rawhide, can be removed when a build with
# https://github.com/rhinstaller/anaconda/pull/1519
# 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
assert_screen "anaconda_main_hub", 30; #
}
sub test_flags {
return { fatal => 1 };
}
1;
# vim: set sw=4 et: