2015-01-22 12:38:16 +00:00
|
|
|
# Copyright (C) 2014 SUSE Linux GmbH
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License along
|
|
|
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use testapi;
|
|
|
|
use autotest;
|
2015-03-18 21:28:03 +00:00
|
|
|
use needle;
|
|
|
|
|
|
|
|
# distribution-specific implementations of expected methods
|
|
|
|
my $distri = testapi::get_var("CASEDIR") . '/lib/fedoradistribution.pm';
|
|
|
|
require $distri;
|
|
|
|
testapi::set_distribution(fedoradistribution->new());
|
|
|
|
|
2016-05-05 23:39:47 +00:00
|
|
|
## UTILITY SUBROUTINES
|
|
|
|
|
|
|
|
|
2015-03-18 21:28:03 +00:00
|
|
|
# Stolen from openSUSE.
|
|
|
|
sub unregister_needle_tags($) {
|
|
|
|
my $tag = shift;
|
|
|
|
my @a = @{ needle::tags($tag) };
|
|
|
|
for my $n (@a) { $n->unregister(); }
|
|
|
|
}
|
|
|
|
|
2015-09-29 22:52:50 +00:00
|
|
|
# The purpose of this function is to un-register all needles which have
|
|
|
|
# at least one tag that starts with a given string (the 'prefix'), if
|
|
|
|
# it does not have any tag that matches the pattern 'prefix-value', for
|
|
|
|
# any of the values given in an array. The first argument passed must
|
|
|
|
# be the prefix; the second must be a reference to the array of values.
|
|
|
|
# For instance, if the 'prefix' is LANGUAGE and the 'values' are
|
|
|
|
# ENGLISH and FRENCH, this function would un-reference a needle which
|
|
|
|
# had only the tag 'LANGUAGE-DUTCH', but it would keep a needle which
|
|
|
|
# had the tag 'LANGUAGE-ENGLISH', or a needle with no tag starting in
|
|
|
|
# 'LANGUAGE-' at all.
|
|
|
|
sub unregister_prefix_tags {
|
|
|
|
my ($prefix, $valueref) = @_;
|
2015-09-15 01:08:58 +00:00
|
|
|
NEEDLE: for my $needle ( needle::all() ) {
|
2015-09-29 22:52:50 +00:00
|
|
|
my $unregister = 0;
|
|
|
|
for my $tag ( @{$needle->{'tags'}} ) {
|
|
|
|
if ($tag =~ /^\Q$prefix/) {
|
|
|
|
# We have at least one tag matching the prefix, so we
|
|
|
|
# *MAY* want to un-register the needle
|
|
|
|
$unregister = 1;
|
|
|
|
for my $value ( @{$valueref} ) {
|
|
|
|
# At any point if we hit a prefix-value match, we
|
|
|
|
# know we need to keep this needle and can skip
|
|
|
|
# to the next
|
|
|
|
next NEEDLE if ($tag eq "$prefix-$value");
|
|
|
|
}
|
|
|
|
}
|
2015-09-15 01:08:58 +00:00
|
|
|
}
|
2015-09-29 22:52:50 +00:00
|
|
|
# We get here if we hit no prefix-value match, but we only want
|
|
|
|
# to unregister the needle if we hit any prefix match, i.e. if
|
|
|
|
# 'unregister' is 1.
|
|
|
|
$needle->unregister() if ($unregister);
|
2015-09-15 01:08:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-18 21:28:03 +00:00
|
|
|
sub cleanup_needles() {
|
add a default_install test for cloud atomic installer image
Summary:
We have these 'atomic installer' images (so far just Cloud),
and maxamillion wanted to get them tested. Turns out it's
pretty trivial - they look much like other installs. Only
little wrinkle is they have a reduced hub (no repository
needles) like live images, but are not like live images in
any other way, so I rejigged the 'small hub needle filtering'
handling a bit.
There will be an accompanying diff for tools, and also some
changes in fedfind (these images are getting built nightly
for *current stable*, and it'd be good to test those).
Because we'd like to test the 22 nightlies, I had to add some
needles for 'olddpi' versions of a few screens. See 2e4c1c2 -
the 22 Atomic installer images still have the old GTK+ code
meaning they run at 96.09dpi. I only retook the necessary
needles for the default-install test, if we add any others we
made need to retake a few more needles.
Test Plan:
Schedule jobs for a compose with the atomic installer
image. You will need the matching openqa_fedora_tools diff and
the very latest git fedfind. Check the test for that image runs,
all other tests run as usual, excessive images are not
downloaded, and the atomic installer is not used for running
universal tests.
Reviewers: jskladan, garretraziel
Reviewed By: garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D595
2015-09-29 18:36:11 +00:00
|
|
|
if (!get_var('LIVE') and !get_var('CANNED')) {
|
|
|
|
## Unregister smaller hub needles. Live and 'canned' installers have
|
|
|
|
## a smaller hub with no repository spokes. On other images we want
|
|
|
|
## to wait for repository setup to complete, but if we match that
|
|
|
|
## spoke's "ready" icon, it breaks live and canned because they
|
|
|
|
## don't have that spoke. So we have a needle which doesn't match
|
|
|
|
## on that icon, but we unregister it for other installs so they
|
|
|
|
## don't match on it too soon.
|
|
|
|
unregister_needle_tags("INSTALLER-smallhub");
|
2015-03-18 21:28:03 +00:00
|
|
|
}
|
2015-09-15 01:08:58 +00:00
|
|
|
|
2015-12-08 10:32:48 +00:00
|
|
|
# Unregister desktop needles of other desktops when DESKTOP is specified
|
|
|
|
if (get_var('DESKTOP')) {
|
|
|
|
unregister_prefix_tags('DESKTOP', [ get_var('DESKTOP') ])
|
|
|
|
}
|
|
|
|
|
2015-09-29 22:52:50 +00:00
|
|
|
# Unregister non-language-appropriate needles. See unregister_except_
|
|
|
|
# tags for details; basically all needles with at least one LANGUAGE-
|
|
|
|
# tag will be unregistered unless they match the current langauge.
|
|
|
|
my $langref = [ get_var('LANGUAGE') || 'english' ];
|
|
|
|
unregister_prefix_tags('LANGUAGE', $langref);
|
2015-03-18 21:28:03 +00:00
|
|
|
}
|
|
|
|
$needle::cleanuphandler = \&cleanup_needles;
|
|
|
|
|
2016-05-05 23:39:47 +00:00
|
|
|
## TEST LOADING SUBROUTINES
|
2015-01-22 12:38:16 +00:00
|
|
|
|
2016-05-05 23:39:47 +00:00
|
|
|
|
|
|
|
sub load_upgrade_tests() {
|
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
2015-09-10 21:49:13 +00:00
|
|
|
# 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)
|
2016-02-10 08:42:56 +00:00
|
|
|
autotest::loadtest "tests/upgrade_preinstall.pm";
|
|
|
|
autotest::loadtest "tests/upgrade_run.pm";
|
2016-05-05 23:39:47 +00:00
|
|
|
# set postinstall test
|
|
|
|
set_var('POSTINSTALL', "upgrade" );
|
2015-05-13 11:00:46 +00:00
|
|
|
}
|
2016-05-05 23:39:47 +00:00
|
|
|
|
|
|
|
sub load_install_tests() {
|
2015-08-05 06:23:59 +00:00
|
|
|
# normal installation test consists of several phases, from which some of them are
|
|
|
|
# loaded automatically and others are loaded based on what env variables are set
|
|
|
|
|
|
|
|
# generally speaking, install test consists of: boot phase, customization phase, installation
|
|
|
|
# and reboot phase, postinstall phase
|
|
|
|
|
|
|
|
# boot phase is loaded automatically every time
|
2016-02-10 08:42:56 +00:00
|
|
|
autotest::loadtest "tests/_boot_to_anaconda.pm";
|
2015-01-30 09:35:13 +00:00
|
|
|
|
2016-05-05 23:39:47 +00:00
|
|
|
# if this is a kickstart install, that's all folks
|
|
|
|
return if (get_var("KICKSTART"));
|
2015-02-04 12:02:54 +00:00
|
|
|
|
2016-05-05 23:39:47 +00:00
|
|
|
## Installation source
|
|
|
|
if (get_var('MIRRORLIST_GRAPHICAL') || get_var("REPOSITORY_GRAPHICAL")){
|
|
|
|
autotest::loadtest "tests/install_source_graphical.pm";
|
|
|
|
}
|
|
|
|
if (get_var("REPOSITORY_VARIATION")){
|
|
|
|
autotest::loadtest "tests/install_source_variation.pm";
|
|
|
|
}
|
2015-02-04 13:45:37 +00:00
|
|
|
|
2016-05-05 23:39:47 +00:00
|
|
|
if (get_var('LIVE')) {
|
|
|
|
# No package set selection for lives.
|
|
|
|
set_var('PACKAGE_SET', "default");
|
|
|
|
}
|
2015-01-30 09:35:13 +00:00
|
|
|
|
2016-05-05 23:39:47 +00:00
|
|
|
## Select package set. Minimal is the default, if 'default' is specified, skip selection.
|
|
|
|
autotest::loadtest "tests/_software_selection.pm";
|
|
|
|
|
|
|
|
## Disk partitioning.
|
|
|
|
# If PARTITIONING is set, we pick the storage test
|
|
|
|
# to run based on the value (usually we run the test with the name
|
|
|
|
# that matches the value, except for a couple of commented cases).
|
|
|
|
my $storage = '';
|
|
|
|
my $partitioning = get_var('PARTITIONING');
|
|
|
|
# if PARTITIONING is unset, or one of [...], use disk_guided_empty,
|
|
|
|
# which is the simplest / 'default' case.
|
|
|
|
if (! $partitioning || $partitioning ~~ ['guided_empty', 'guided_free_space']) {
|
|
|
|
$storage = "tests/disk_guided_empty.pm";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$storage = "tests/disk_".$partitioning.".pm";
|
|
|
|
}
|
|
|
|
autotest::loadtest $storage;
|
2015-02-04 16:16:21 +00:00
|
|
|
|
2016-05-05 23:39:47 +00:00
|
|
|
if (get_var("ENCRYPT_PASSWORD")){
|
|
|
|
autotest::loadtest "tests/disk_guided_encrypted.pm";
|
2015-01-27 13:22:35 +00:00
|
|
|
}
|
2015-01-27 12:35:27 +00:00
|
|
|
|
2016-05-05 23:39:47 +00:00
|
|
|
# Start installation, set user & root passwords, reboot
|
|
|
|
# install and reboot phase is loaded automatically every time (except when KICKSTART is set)
|
|
|
|
autotest::loadtest "tests/_do_install_and_reboot.pm";
|
|
|
|
}
|
|
|
|
|
|
|
|
sub load_postinstall_tests() {
|
2015-07-31 08:31:27 +00:00
|
|
|
# Unlock encrypted storage volumes, if necessary. The test name here
|
|
|
|
# follows the 'storage post-install' convention, but must be run earlier.
|
2016-05-05 23:39:47 +00:00
|
|
|
if (get_var("ENCRYPT_PASSWORD")) {
|
2016-02-10 08:42:56 +00:00
|
|
|
autotest::loadtest "tests/disk_guided_encrypted_postinstall.pm";
|
2015-02-04 16:16:21 +00:00
|
|
|
}
|
2015-03-18 21:28:03 +00:00
|
|
|
|
|
|
|
# Appropriate login method for install type
|
|
|
|
if (get_var("DESKTOP")) {
|
2016-02-10 08:42:56 +00:00
|
|
|
autotest::loadtest "tests/_graphical_wait_login.pm";
|
2015-03-18 21:28:03 +00:00
|
|
|
}
|
|
|
|
else {
|
2016-02-10 08:42:56 +00:00
|
|
|
autotest::loadtest "tests/_console_wait_login.pm";
|
2015-03-18 21:28:03 +00:00
|
|
|
}
|
2015-01-30 09:35:13 +00:00
|
|
|
|
2015-08-05 06:23:59 +00:00
|
|
|
# from now on, we have fully installed and booted system with root/specified user logged in
|
|
|
|
|
2015-07-31 08:31:27 +00:00
|
|
|
# If there is a post-install test to verify storage configuration worked
|
|
|
|
# correctly, run it. Again we determine the test name based on the value
|
2015-08-06 09:02:18 +00:00
|
|
|
# of PARTITIONING
|
2015-07-31 08:31:27 +00:00
|
|
|
my $storagepost = '';
|
2015-08-06 09:02:18 +00:00
|
|
|
if (get_var('PARTITIONING')) {
|
2016-02-10 08:42:56 +00:00
|
|
|
my $loc = "tests/disk_".get_var('PARTITIONING')."_postinstall.pm";
|
2015-07-31 08:31:27 +00:00
|
|
|
$storagepost = $loc if (-e $loc);
|
2015-03-06 09:36:25 +00:00
|
|
|
}
|
2015-07-31 08:31:27 +00:00
|
|
|
autotest::loadtest $storagepost if ($storagepost);
|
2015-09-15 09:04:01 +00:00
|
|
|
|
|
|
|
if (get_var("UEFI")) {
|
2016-02-10 08:42:56 +00:00
|
|
|
autotest::loadtest "tests/uefi_postinstall.pm";
|
2015-09-15 09:04:01 +00:00
|
|
|
}
|
2016-03-23 20:52:00 +00:00
|
|
|
|
|
|
|
# generic post-install test load
|
|
|
|
if (get_var("POSTINSTALL")) {
|
add a cockpit realmd FreeIPA join test
Summary:
This requires a few other changes:
* turn clone_host_resolv into clone_host_file, letting you clone
any given host file (cloning /etc/hosts seems to make both
server deployment and client enrolment faster/more reliable)
* allow loading of multiple POSTINSTALL tests (so we can share
the freeipa_client_postinstall test). Note this is compatible,
existing uses will work fine
* move initial password change for the IPA test users into the
server deployment test (so the client tests don't conflict over
doing that)
* add GRUB_POSTINSTALL, for specifying boot parameters for boot of
the installed system, and make it work by tweaking _console_wait
_login (doesn't work for _graphical_wait_login yet, as I didn't
need that)
* make the static networking config for tap tests into a library
function so the tests can share it
* handle ABRT problem dirs showing up in /var/spool/abrt as well
as /var/tmp/abrt (because the enrol attempt hits #1330766 and
the crash report shows up in /var/spool/abrt, don't ask me why
the difference, I just work here)
* specify the DNS servers from the worker host's resolv.conf as
the forwarders for the FreeIPA server when deploying it; if we
don't do this, rolekit defaults to using the root servers as
forwarders(!) and thus we get the public, not phx2-appropriate,
results for e.g. mirrors.fedoraproject.org, some of which the
workers can't reach, so PackageKit package install always fails
(boy, was it fun figuring THAT mess out)
Even after all that, the test still doesn't actually pass, but
I'm reasonably confident this is because it's hitting actual bugs,
not because it's broken. It runs into #1330766 nearly every time
(I think I saw *one* time the enrolment actually succeeded), and
seems to run into a subsequent bug I hadn't seen before when
trying to work around that by trying the join again (see
https://bugzilla.redhat.com/show_bug.cgi?id=1330766#c37 ).
Test Plan:
Run the test, see what happens. If you're really lucky,
it'll actually pass. But you'll probably run into #1330766#c37,
I'm mostly posting for comment. You'll need a tap-capable openQA
instance to test this.
Reviewers: jskladan, garretraziel
Reviewed By: garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D880
2016-06-07 20:00:39 +00:00
|
|
|
my @pis = split(/ /, get_var("POSTINSTALL"));
|
|
|
|
foreach my $pi (@pis) {
|
|
|
|
autotest::loadtest "tests/${pi}_postinstall.pm";
|
|
|
|
}
|
2016-03-23 20:52:00 +00:00
|
|
|
}
|
|
|
|
|
shutdown before uploading disk images
Summary:
I believe the failures in the Server DVD chained Base tests are
happening because the VM is not cleanly shut down before the disk
image is uploaded. This adds a shutdown step to all tests that
upload a disk image (so, for now, just default_install). To keep
things simple it just runs 'shutdown' from a root console, rather
than using graphical desktop shutdown methods, as the aim is only
to make the disk state clean, not to test shutdown exactly.
I've tested this on staging; a Server DVD test run with this
change produced a full set of passed tests, as opposed to all
the Base tests failing because the system didn't boot properly.
Workstation and KDE tests seem to work fine also.
For the record, SUSE does much the same thing as this commit.
Test Plan:
Do a full test run and make sure everything that worked
before still does. Check that all default_install tests have a
_console_shutdown step added, and it works, and all chained tests
work (or fail for some unrelated reason, but make sure this
doesn't break them).
Reviewers: jskladan, garretraziel
Reviewed By: garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D787
2016-03-22 14:19:47 +00:00
|
|
|
# we should shut down before uploading disk images
|
|
|
|
if (get_var("STORE_HDD_1") || get_var("PUBLISH_HDD_1")) {
|
|
|
|
autotest::loadtest "tests/_console_shutdown.pm";
|
|
|
|
}
|
2015-01-26 14:58:07 +00:00
|
|
|
}
|
|
|
|
|
2016-05-05 23:39:47 +00:00
|
|
|
## LOADING STARTS HERE
|
|
|
|
|
2015-01-22 12:38:16 +00:00
|
|
|
|
2016-05-05 23:39:47 +00:00
|
|
|
# if user set ENTRYPOINT, run required test directly
|
|
|
|
# (good for tests where it doesn't make sense to use _boot_to_anaconda, _software_selection etc.)
|
|
|
|
if (get_var("ENTRYPOINT")) {
|
|
|
|
autotest::loadtest "tests/".get_var("ENTRYPOINT").".pm";
|
|
|
|
}
|
|
|
|
elsif (get_var("UPGRADE")) {
|
|
|
|
load_upgrade_tests;
|
|
|
|
}
|
|
|
|
elsif (!get_var("START_AFTER_TEST")) {
|
|
|
|
# for now we can assume START_AFTER_TEST means this test picks up
|
|
|
|
# after an install, so we skip to post-install
|
|
|
|
load_install_tests;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!get_var("ENTRYPOINT")) {
|
|
|
|
load_postinstall_tests;
|
|
|
|
}
|
2015-01-30 09:35:13 +00:00
|
|
|
|
2015-01-22 12:38:16 +00:00
|
|
|
1;
|
|
|
|
|
|
|
|
# vim: set sw=4 et:
|