2017-01-18 07:15:44 +00:00
|
|
|
package utils;
|
2016-09-07 08:34:54 +00:00
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
use base 'Exporter';
|
|
|
|
use Exporter;
|
|
|
|
|
2017-01-18 07:15:44 +00:00
|
|
|
use lockapi;
|
2016-09-07 08:34:54 +00:00
|
|
|
use testapi;
|
2017-04-03 23:23:45 +00:00
|
|
|
our @EXPORT = qw/run_with_error_check type_safely type_very_safely desktop_vt boot_to_login_screen console_login console_switch_layout desktop_switch_layout console_loadkeys_us do_bootloader get_milestone boot_decrypt check_release menu_launch_type start_cockpit repo_setup gnome_initial_setup anaconda_create_user/;
|
2016-09-07 08:34:54 +00:00
|
|
|
|
|
|
|
sub run_with_error_check {
|
|
|
|
my ($func, $error_screen) = @_;
|
|
|
|
die "Error screen appeared" if (check_screen $error_screen, 5);
|
|
|
|
$func->();
|
|
|
|
die "Error screen appeared" if (check_screen $error_screen, 5);
|
|
|
|
}
|
2016-09-12 17:24:30 +00:00
|
|
|
|
|
|
|
# high-level 'type this string quite safely but reasonably fast'
|
|
|
|
# function whose specific implementation may vary
|
|
|
|
sub type_safely {
|
|
|
|
my $string = shift;
|
2016-10-20 16:12:55 +00:00
|
|
|
type_string($string, wait_screen_change => 3, max_interval => 20);
|
2016-09-12 17:24:30 +00:00
|
|
|
wait_still_screen 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
# high-level 'type this string extremely safely and rather slow'
|
|
|
|
# function whose specific implementation may vary
|
|
|
|
sub type_very_safely {
|
|
|
|
my $string = shift;
|
2016-10-20 16:12:55 +00:00
|
|
|
type_string($string, wait_screen_change => 1, max_interval => 1);
|
2016-09-12 17:24:30 +00:00
|
|
|
wait_still_screen 5;
|
|
|
|
}
|
2016-09-24 19:42:39 +00:00
|
|
|
|
|
|
|
# Figure out what tty the desktop is on, switch to it. Assumes we're
|
|
|
|
# at a root console
|
|
|
|
sub desktop_vt {
|
|
|
|
# use ps to find the tty of Xwayland or Xorg
|
|
|
|
my $xout;
|
|
|
|
# don't fail test if we don't find any process, just guess tty1
|
|
|
|
eval { $xout = script_output 'ps -C Xwayland,Xorg -o tty --no-headers'; };
|
|
|
|
my $tty = 1; # default
|
|
|
|
while ($xout =~ /tty(\d)/g) {
|
|
|
|
$tty = $1; # most recent match is probably best
|
|
|
|
}
|
|
|
|
send_key "ctrl-alt-f${tty}";
|
|
|
|
}
|
consolidate login waits, use postinstall not entrypoint for base
Summary:
I started out wanting to fix an issue I noticed today where
graphical upgrade tests were failing because they didn't wait
for the graphical login screen properly; the test was sitting
at the 'full Fedora logo' state of plymouth for a long time,
so the current boot_to_login_screen's wait_still_screen was
triggered by it and the function wound up failing on the
assert_screen, because it was still some time before the real
login screen appeared.
So I tweaked the boot_to_login_screen implementation to work
slightly differently (look for a login screen match, *then* -
if we're dealing with a graphical login - wait_still_screen
to defeat the 'old GPU buffer showing login screen' problem
and assert the login screen again). But while working on it,
I figured we really should consolidate all the various places
that handle the bootloader -> login, we were doing it quite
differently in all sorts of different places. And as part of
that, I converted the base tests to use POSTINSTALL (and thus
go through the shared _wait_login tests) instead of handling
boot themselves. As part of *that*, I tweaked main.pm to not
require all POSTINSTALL tests have the _postinstall suffix on
their names, as it really doesn't make sense, and renamed the
tests.
Test Plan: Run all tests, see if they work.
Reviewers: jskladan, garretraziel
Reviewed By: garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D1015
2016-09-27 18:48:15 +00:00
|
|
|
|
|
|
|
# Wait for login screen to appear. Handle the annoying GPU buffer
|
|
|
|
# problem where we see a stale copy of the login screen from the
|
|
|
|
# previous boot. Will suffer a ~30 second delay if there's a chance
|
|
|
|
# we're *already at* the expected login screen.
|
|
|
|
sub boot_to_login_screen {
|
|
|
|
my %args = @_;
|
|
|
|
$args{timeout} //= 300;
|
|
|
|
# we may start at a screen that matches one of the needles; if so,
|
|
|
|
# wait till we don't (e.g. when rebooting at end of live install,
|
|
|
|
# we match text_console_login until the console disappears)
|
|
|
|
my $count = 5;
|
|
|
|
while (check_screen("login_screen", 3) && $count > 0) {
|
|
|
|
sleep 5;
|
|
|
|
$count -= 1;
|
|
|
|
}
|
|
|
|
assert_screen "login_screen", $args{timeout};
|
|
|
|
if (match_has_tag "graphical_login") {
|
|
|
|
wait_still_screen 10, 30;
|
|
|
|
assert_screen "login_screen";
|
|
|
|
}
|
|
|
|
}
|
redo console_login with multiple matches, move to main_common
Summary:
Since we can match on multiple needles, we can drop the loop
from console_login and instead do it this way, which is simpler
and should work better on ARM (the timeouts will scale and
allow ARM to be slow here). Also move it to main_common as
there's no logical reason for it to be a class method.
Also remove the `check` arg. `check` was only set to 0 by two
tests, _console_shutdown and anacondatest's _post_fail_hook.
For _console_shutdown, I think I just wanted to give it the
best possible chance of succeeding. But we're really not going
to lose anything significant by checking, the only case where
check=>0 would've helped is if the 'good' needle had stopped
matching, and all sorts of other tests will fail in that case.
anacondatest was only using it to save a screenshot of whatever
was on the tty if it didn't reach a root console, which doesn't
seem that useful, and we'll get screenshots from check_screen
and assert_screen anyway.
Test Plan:
Run all tests, check they behave as expected and
none inappropriately fails on console login.
Reviewers: jskladan, garretraziel
Reviewed By: garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D1016
2016-09-30 15:42:45 +00:00
|
|
|
|
|
|
|
# Switch keyboard layouts at a console
|
|
|
|
sub console_switch_layout {
|
|
|
|
# switcher key combo differs between layouts, for console
|
|
|
|
if (get_var("LANGUAGE", "") eq "russian") {
|
|
|
|
send_key "ctrl-shift";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-21 16:41:00 +00:00
|
|
|
# switch to 'native' or 'ascii' input method in a graphical desktop
|
|
|
|
# usually switched configs have one mode for inputting ascii-ish
|
|
|
|
# characters (which may be 'us' keyboard layout, or a local layout for
|
|
|
|
# inputting ascii like 'jp') and one mode for inputting native
|
|
|
|
# characters (which may be another keyboard layout, like 'ru', or an
|
|
|
|
# input method for more complex languages)
|
2016-12-16 17:40:29 +00:00
|
|
|
# 'environment' can be a desktop name or 'anaconda' for anaconda
|
|
|
|
# if not set, will use get_var('DESKTOP') or default 'anaconda'
|
|
|
|
sub desktop_switch_layout {
|
|
|
|
my ($layout, $environment) = @_;
|
2016-12-21 16:41:00 +00:00
|
|
|
$layout //= 'ascii';
|
2016-12-16 17:40:29 +00:00
|
|
|
$environment //= get_var("DESKTOP", "anaconda");
|
|
|
|
# if already selected, we're good
|
|
|
|
return if (check_screen "${environment}_layout_${layout}", 3);
|
|
|
|
# otherwise we need to switch
|
|
|
|
my $switcher = "alt-shift"; # anaconda
|
|
|
|
$switcher = "super-spc" if $environment eq 'gnome';
|
|
|
|
# KDE? not used yet
|
|
|
|
send_key $switcher;
|
|
|
|
assert_screen "${environment}_layout_${layout}", 3;
|
|
|
|
}
|
|
|
|
|
redo console_login with multiple matches, move to main_common
Summary:
Since we can match on multiple needles, we can drop the loop
from console_login and instead do it this way, which is simpler
and should work better on ARM (the timeouts will scale and
allow ARM to be slow here). Also move it to main_common as
there's no logical reason for it to be a class method.
Also remove the `check` arg. `check` was only set to 0 by two
tests, _console_shutdown and anacondatest's _post_fail_hook.
For _console_shutdown, I think I just wanted to give it the
best possible chance of succeeding. But we're really not going
to lose anything significant by checking, the only case where
check=>0 would've helped is if the 'good' needle had stopped
matching, and all sorts of other tests will fail in that case.
anacondatest was only using it to save a screenshot of whatever
was on the tty if it didn't reach a root console, which doesn't
seem that useful, and we'll get screenshots from check_screen
and assert_screen anyway.
Test Plan:
Run all tests, check they behave as expected and
none inappropriately fails on console login.
Reviewers: jskladan, garretraziel
Reviewed By: garretraziel
Subscribers: tflink
Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D1016
2016-09-30 15:42:45 +00:00
|
|
|
# this subroutine handles logging in as a root/specified user into console
|
|
|
|
# it requires TTY to be already displayed (handled by the root_console()
|
|
|
|
# method of distribution classes)
|
|
|
|
sub console_login {
|
|
|
|
my %args = (
|
|
|
|
user => "root",
|
|
|
|
password => get_var("ROOT_PASSWORD", "weakpassword"),
|
|
|
|
@_);
|
|
|
|
|
|
|
|
# There's a timing problem when we switch from a logged-in console
|
|
|
|
# to a non-logged in console and immediately call this function;
|
|
|
|
# if the switch lags a bit, this function will match one of the
|
|
|
|
# logged-in needles for the console we switched from, and get out
|
|
|
|
# of sync (e.g. https://openqa.stg.fedoraproject.org/tests/1664 )
|
|
|
|
# To avoid this, we'll sleep a couple of seconds before starting
|
|
|
|
sleep 2;
|
|
|
|
|
|
|
|
my $good = "";
|
|
|
|
my $bad = "";
|
|
|
|
if ($args{user} eq "root") {
|
|
|
|
$good = "root_console";
|
|
|
|
$bad = "user_console";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$good = "user_console";
|
|
|
|
$bad = "root_console";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (check_screen $bad, 0) {
|
|
|
|
# we don't want to 'wait' for this as it won't return
|
|
|
|
script_run "exit", 0;
|
|
|
|
sleep 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
check_screen [$good, 'text_console_login'], 10;
|
|
|
|
# if we're already logged in, all is good
|
|
|
|
return if (match_has_tag $good);
|
|
|
|
# if we see the login prompt, type the username
|
|
|
|
type_string("$args{user}\n") if (match_has_tag 'text_console_login');
|
|
|
|
check_screen [$good, 'console_password_required'], 30;
|
|
|
|
# on a live image, just the user name will be enough
|
|
|
|
return if (match_has_tag $good);
|
|
|
|
# otherwise, type the password if we see the prompt
|
|
|
|
if (match_has_tag 'console_password_required') {
|
|
|
|
type_string "$args{password}";
|
|
|
|
if (get_var("SWITCHED_LAYOUT") and $args{user} ne "root") {
|
|
|
|
# see _do_install_and_reboot; when layout is switched
|
|
|
|
# user password is doubled to contain both US and native
|
|
|
|
# chars
|
|
|
|
console_switch_layout;
|
|
|
|
type_string "$args{password}";
|
|
|
|
console_switch_layout;
|
|
|
|
}
|
|
|
|
send_key "ret";
|
|
|
|
}
|
|
|
|
# make sure we reached the console
|
|
|
|
assert_screen($good, 30);
|
|
|
|
}
|
2016-12-08 20:03:26 +00:00
|
|
|
|
|
|
|
# load US layout (from a root console)
|
|
|
|
sub console_loadkeys_us {
|
|
|
|
if (get_var('LANGUAGE') eq 'french') {
|
|
|
|
script_run "loqdkeys us", 0;
|
|
|
|
}
|
|
|
|
}
|
2017-01-18 07:15:44 +00:00
|
|
|
|
|
|
|
sub do_bootloader {
|
|
|
|
# Handle bootloader screen. 'bootloader' is syslinux or grub.
|
|
|
|
# 'uefi' is whether this is a UEFI install, will get_var UEFI if
|
|
|
|
# not explicitly set. 'postinstall' is whether we're on an
|
|
|
|
# installed system or at the installer (this matters for how many
|
|
|
|
# times we press 'down' to find the kernel line when typing args).
|
|
|
|
# 'args' is a string of extra kernel args, if desired. 'mutex' is
|
|
|
|
# a parallel test mutex lock to wait for before proceeding, if
|
|
|
|
# desired. 'first' is whether to hit 'up' a couple of times to
|
|
|
|
# make sure we boot the first menu entry. 'timeout' is how long to
|
|
|
|
# wait for the bootloader screen.
|
|
|
|
my %args = (
|
|
|
|
postinstall => 0,
|
|
|
|
params => "",
|
|
|
|
mutex => "",
|
|
|
|
first => 1,
|
|
|
|
timeout => 30,
|
|
|
|
uefi => get_var("UEFI"),
|
|
|
|
@_
|
|
|
|
);
|
|
|
|
# if not postinstall and not UEFI, syslinux
|
|
|
|
$args{bootloader} //= ($args{uefi} || $args{postinstall}) ? "grub" : "syslinux";
|
|
|
|
if ($args{uefi}) {
|
|
|
|
# we use the firmware-type specific tags because we want to be
|
|
|
|
# sure we actually did a UEFI boot
|
|
|
|
assert_screen "bootloader_uefi", $args{timeout};
|
|
|
|
} else {
|
|
|
|
assert_screen "bootloader_bios", $args{timeout};
|
|
|
|
}
|
|
|
|
if ($args{mutex}) {
|
|
|
|
# cancel countdown
|
|
|
|
send_key "left";
|
|
|
|
mutex_lock $args{mutex};
|
|
|
|
mutex_unlock $args{mutex};
|
|
|
|
}
|
|
|
|
if ($args{first}) {
|
|
|
|
# press up a couple of times to make sure we're at first entry
|
|
|
|
send_key "up";
|
|
|
|
send_key "up";
|
|
|
|
}
|
|
|
|
if ($args{params}) {
|
|
|
|
if ($args{bootloader} eq "syslinux") {
|
|
|
|
send_key "tab";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
send_key "e";
|
|
|
|
# ternary: 13 'downs' to reach the kernel line for installed
|
|
|
|
# system, 2 for UEFI installer
|
|
|
|
my $presses = $args{postinstall} ? 13 : 2;
|
|
|
|
foreach my $i (1..$presses) {
|
|
|
|
send_key "down";
|
|
|
|
}
|
|
|
|
send_key "end";
|
|
|
|
}
|
|
|
|
type_string " $args{params}";
|
|
|
|
}
|
|
|
|
# ctrl-X boots from grub editor mode
|
|
|
|
send_key "ctrl-x";
|
|
|
|
# return boots all other cases
|
|
|
|
send_key "ret";
|
|
|
|
}
|
|
|
|
|
|
|
|
sub get_milestone {
|
|
|
|
# FIXME: we don't know how to do this with Pungi 4 yet.
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
sub boot_decrypt {
|
|
|
|
# decrypt storage during boot; arg is timeout (in seconds)
|
|
|
|
my $timeout = shift || 60;
|
|
|
|
assert_screen "boot_enter_passphrase", $timeout; #
|
|
|
|
type_string get_var("ENCRYPT_PASSWORD");
|
|
|
|
send_key "ret";
|
|
|
|
}
|
|
|
|
|
|
|
|
sub 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.
|
|
|
|
my $release = shift;
|
|
|
|
my $check_command = "grep SUPPORT_PRODUCT_VERSION /usr/lib/os.release.d/os-release-fedora";
|
|
|
|
validate_script_output $check_command, sub { $_ =~ m/REDHAT_SUPPORT_PRODUCT_VERSION=$release/ };
|
|
|
|
}
|
|
|
|
|
|
|
|
sub menu_launch_type {
|
|
|
|
# Launch an application in a graphical environment, by opening a
|
|
|
|
# launcher, typing the specified string and hitting enter. Pass
|
|
|
|
# the string to be typed to launch whatever it is you want.
|
|
|
|
my $app = shift;
|
|
|
|
# super does not work on KDE, because fml
|
|
|
|
send_key 'alt-f1';
|
|
|
|
# srsly KDE y u so slo
|
|
|
|
wait_still_screen 3;
|
|
|
|
type_very_safely $app;
|
|
|
|
send_key 'ret';
|
|
|
|
}
|
|
|
|
|
|
|
|
sub start_cockpit {
|
|
|
|
# Starting from a console, get to a browser with Cockpit (running
|
|
|
|
# on localhost) shown. If $login is truth-y, also log in. Assumes
|
|
|
|
# X and Firefox are installed.
|
|
|
|
my $login = shift || 0;
|
|
|
|
# run firefox directly in X as root. never do this, kids!
|
|
|
|
type_string "startx /usr/bin/firefox -width 1024 -height 768 http://localhost:9090\n";
|
|
|
|
assert_screen "cockpit_login";
|
|
|
|
wait_still_screen 5;
|
|
|
|
if ($login) {
|
|
|
|
type_safely "root";
|
|
|
|
wait_screen_change { send_key "tab"; };
|
|
|
|
type_safely get_var("ROOT_PASSWORD", "weakpassword");
|
|
|
|
send_key "ret";
|
|
|
|
assert_screen "cockpit_main";
|
|
|
|
# wait for any animation or other weirdness
|
|
|
|
# can't use wait_still_screen because of that damn graph
|
|
|
|
sleep 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Add support for testing updates
Summary:
This adds an entirely new workflow for testing distribution
updates. The `ADVISORY` variable is introduced: when set,
`main.pm` will load an early post-install test that sets up
a repository containing the packages from the specified update,
runs `dnf -y update`, and reboots. A new templates file is
added, `templates-updates`, which adds two new flavors called
`updates-server` and `updates-workstation`, each containing
job templates for appropriate post-install tests. Scheduler is
expected to post `ADVISORY=(update ID) HDD_1=(base image)
FLAVOR=updates-(server|workstation)`, where (base image) is one
of the stable release base disk images produced by `createhdds`
and usually used for upgrade testing. This will result in the
appropriate job templates being loaded.
We rejig postinstall test loading and static network config a
bit so that this works for both the 'compose' and 'updates' test
flows: we have to ensure we bring up networking for the tap
tests before we try and install the updates, but still allow
later adjustment of the configuration. We take advantage of the
openQA feature that was added a few months back to run the same
module multiple times, so the `_advisory_update` module can
reboot after installing the updates and the modules that take
care of bootloader, encryption and login get run again. This
looks slightly wacky in the web UI, though - it doesn't show the
later runs of each module.
We also use the recently added feature to specify `+HDD_1` in
the test suites which use a disk image uploaded by an earlier
post-install test, so the test suite value will take priority
over the value POSTed by the scheduler for those tests, and we
will use the uploaded disk image (and not the clean base image
POSTed by the scheduler) for those tests.
My intent here is to enhance the scheduler, adding a consumer
which listens out for critpath updates, and runs this test flow
for each one, then reports the results to ResultsDB where Bodhi
could query and display them. We could also add a list of other
packages to have one or both sets of update tests run on it, I
guess.
Test Plan:
Try a post something like:
HDD_1=disk_f25_server_3_x86_64.img DISTRI=fedora VERSION=25
FLAVOR=updates-server ARCH=x86_64 BUILD=FEDORA-2017-376ae2b92c
ADVISORY=FEDORA-2017-376ae2b92c CURRREL=25 PREVREL=24
Pick an appropriate `ADVISORY` (ideally, one containing some
packages which might actually be involved in the tests), and
matching `FLAVOR` and `HDD_1`. The appropriate tests should run,
a repo with the update packages should be created and enabled
(and dnf update run), and the tests should work properly. Also
test a regular compose run to make sure I didn't break anything.
Reviewers: jskladan, jsedlak
Reviewed By: jsedlak
Subscribers: tflink
Differential Revision: https://phab.qa.fedoraproject.org/D1143
2017-01-25 16:16:12 +00:00
|
|
|
sub _repo_setup_compose {
|
|
|
|
# Appropriate repo setup steps for testing a compose
|
2017-01-18 07:15:44 +00:00
|
|
|
# disable updates-testing and updates and use the compose location
|
|
|
|
# as the target for fedora and rawhide rather than mirrorlist, so
|
|
|
|
# tools see only packages from the compose under test
|
|
|
|
my $location = get_var("LOCATION");
|
Add support for testing updates
Summary:
This adds an entirely new workflow for testing distribution
updates. The `ADVISORY` variable is introduced: when set,
`main.pm` will load an early post-install test that sets up
a repository containing the packages from the specified update,
runs `dnf -y update`, and reboots. A new templates file is
added, `templates-updates`, which adds two new flavors called
`updates-server` and `updates-workstation`, each containing
job templates for appropriate post-install tests. Scheduler is
expected to post `ADVISORY=(update ID) HDD_1=(base image)
FLAVOR=updates-(server|workstation)`, where (base image) is one
of the stable release base disk images produced by `createhdds`
and usually used for upgrade testing. This will result in the
appropriate job templates being loaded.
We rejig postinstall test loading and static network config a
bit so that this works for both the 'compose' and 'updates' test
flows: we have to ensure we bring up networking for the tap
tests before we try and install the updates, but still allow
later adjustment of the configuration. We take advantage of the
openQA feature that was added a few months back to run the same
module multiple times, so the `_advisory_update` module can
reboot after installing the updates and the modules that take
care of bootloader, encryption and login get run again. This
looks slightly wacky in the web UI, though - it doesn't show the
later runs of each module.
We also use the recently added feature to specify `+HDD_1` in
the test suites which use a disk image uploaded by an earlier
post-install test, so the test suite value will take priority
over the value POSTed by the scheduler for those tests, and we
will use the uploaded disk image (and not the clean base image
POSTed by the scheduler) for those tests.
My intent here is to enhance the scheduler, adding a consumer
which listens out for critpath updates, and runs this test flow
for each one, then reports the results to ResultsDB where Bodhi
could query and display them. We could also add a list of other
packages to have one or both sets of update tests run on it, I
guess.
Test Plan:
Try a post something like:
HDD_1=disk_f25_server_3_x86_64.img DISTRI=fedora VERSION=25
FLAVOR=updates-server ARCH=x86_64 BUILD=FEDORA-2017-376ae2b92c
ADVISORY=FEDORA-2017-376ae2b92c CURRREL=25 PREVREL=24
Pick an appropriate `ADVISORY` (ideally, one containing some
packages which might actually be involved in the tests), and
matching `FLAVOR` and `HDD_1`. The appropriate tests should run,
a repo with the update packages should be created and enabled
(and dnf update run), and the tests should work properly. Also
test a regular compose run to make sure I didn't break anything.
Reviewers: jskladan, jsedlak
Reviewed By: jsedlak
Subscribers: tflink
Differential Revision: https://phab.qa.fedoraproject.org/D1143
2017-01-25 16:16:12 +00:00
|
|
|
return unless $location;
|
2017-01-18 07:15:44 +00:00
|
|
|
assert_script_run 'dnf config-manager --set-disabled updates-testing updates';
|
|
|
|
# we use script_run here as the rawhide repo file won't always exist
|
|
|
|
# and we don't want to bother testing or predicting its existence;
|
|
|
|
# assert_script_run doesn't buy you much with sed anyway as it'll
|
|
|
|
# return 0 even if it replaced nothing
|
|
|
|
script_run "sed -i -e 's,^metalink,#metalink,g' -e 's,^#baseurl.*basearch,baseurl=${location}/Everything/\$basearch,g' /etc/yum.repos.d/{fedora,fedora-rawhide}.repo", 0;
|
|
|
|
script_run "cat /etc/yum.repos.d/{fedora,fedora-rawhide}.repo", 0;
|
|
|
|
}
|
|
|
|
|
Add support for testing updates
Summary:
This adds an entirely new workflow for testing distribution
updates. The `ADVISORY` variable is introduced: when set,
`main.pm` will load an early post-install test that sets up
a repository containing the packages from the specified update,
runs `dnf -y update`, and reboots. A new templates file is
added, `templates-updates`, which adds two new flavors called
`updates-server` and `updates-workstation`, each containing
job templates for appropriate post-install tests. Scheduler is
expected to post `ADVISORY=(update ID) HDD_1=(base image)
FLAVOR=updates-(server|workstation)`, where (base image) is one
of the stable release base disk images produced by `createhdds`
and usually used for upgrade testing. This will result in the
appropriate job templates being loaded.
We rejig postinstall test loading and static network config a
bit so that this works for both the 'compose' and 'updates' test
flows: we have to ensure we bring up networking for the tap
tests before we try and install the updates, but still allow
later adjustment of the configuration. We take advantage of the
openQA feature that was added a few months back to run the same
module multiple times, so the `_advisory_update` module can
reboot after installing the updates and the modules that take
care of bootloader, encryption and login get run again. This
looks slightly wacky in the web UI, though - it doesn't show the
later runs of each module.
We also use the recently added feature to specify `+HDD_1` in
the test suites which use a disk image uploaded by an earlier
post-install test, so the test suite value will take priority
over the value POSTed by the scheduler for those tests, and we
will use the uploaded disk image (and not the clean base image
POSTed by the scheduler) for those tests.
My intent here is to enhance the scheduler, adding a consumer
which listens out for critpath updates, and runs this test flow
for each one, then reports the results to ResultsDB where Bodhi
could query and display them. We could also add a list of other
packages to have one or both sets of update tests run on it, I
guess.
Test Plan:
Try a post something like:
HDD_1=disk_f25_server_3_x86_64.img DISTRI=fedora VERSION=25
FLAVOR=updates-server ARCH=x86_64 BUILD=FEDORA-2017-376ae2b92c
ADVISORY=FEDORA-2017-376ae2b92c CURRREL=25 PREVREL=24
Pick an appropriate `ADVISORY` (ideally, one containing some
packages which might actually be involved in the tests), and
matching `FLAVOR` and `HDD_1`. The appropriate tests should run,
a repo with the update packages should be created and enabled
(and dnf update run), and the tests should work properly. Also
test a regular compose run to make sure I didn't break anything.
Reviewers: jskladan, jsedlak
Reviewed By: jsedlak
Subscribers: tflink
Differential Revision: https://phab.qa.fedoraproject.org/D1143
2017-01-25 16:16:12 +00:00
|
|
|
sub _repo_setup_updates {
|
|
|
|
# Appropriate repo setup steps for testing a Bodhi update
|
|
|
|
# Check if we already ran, bail if so
|
|
|
|
return unless script_run "test -f /etc/yum.repos.d/advisory.repo";
|
2017-03-13 19:43:54 +00:00
|
|
|
# Use baseurl not metalink so we don't hit the timing issue where
|
|
|
|
# the infra repo is updated but mirrormanager metadata checksums
|
|
|
|
# have not been updated, and the infra repo is rejected as its
|
|
|
|
# metadata checksum isn't known to MM
|
Add support for testing updates
Summary:
This adds an entirely new workflow for testing distribution
updates. The `ADVISORY` variable is introduced: when set,
`main.pm` will load an early post-install test that sets up
a repository containing the packages from the specified update,
runs `dnf -y update`, and reboots. A new templates file is
added, `templates-updates`, which adds two new flavors called
`updates-server` and `updates-workstation`, each containing
job templates for appropriate post-install tests. Scheduler is
expected to post `ADVISORY=(update ID) HDD_1=(base image)
FLAVOR=updates-(server|workstation)`, where (base image) is one
of the stable release base disk images produced by `createhdds`
and usually used for upgrade testing. This will result in the
appropriate job templates being loaded.
We rejig postinstall test loading and static network config a
bit so that this works for both the 'compose' and 'updates' test
flows: we have to ensure we bring up networking for the tap
tests before we try and install the updates, but still allow
later adjustment of the configuration. We take advantage of the
openQA feature that was added a few months back to run the same
module multiple times, so the `_advisory_update` module can
reboot after installing the updates and the modules that take
care of bootloader, encryption and login get run again. This
looks slightly wacky in the web UI, though - it doesn't show the
later runs of each module.
We also use the recently added feature to specify `+HDD_1` in
the test suites which use a disk image uploaded by an earlier
post-install test, so the test suite value will take priority
over the value POSTed by the scheduler for those tests, and we
will use the uploaded disk image (and not the clean base image
POSTed by the scheduler) for those tests.
My intent here is to enhance the scheduler, adding a consumer
which listens out for critpath updates, and runs this test flow
for each one, then reports the results to ResultsDB where Bodhi
could query and display them. We could also add a list of other
packages to have one or both sets of update tests run on it, I
guess.
Test Plan:
Try a post something like:
HDD_1=disk_f25_server_3_x86_64.img DISTRI=fedora VERSION=25
FLAVOR=updates-server ARCH=x86_64 BUILD=FEDORA-2017-376ae2b92c
ADVISORY=FEDORA-2017-376ae2b92c CURRREL=25 PREVREL=24
Pick an appropriate `ADVISORY` (ideally, one containing some
packages which might actually be involved in the tests), and
matching `FLAVOR` and `HDD_1`. The appropriate tests should run,
a repo with the update packages should be created and enabled
(and dnf update run), and the tests should work properly. Also
test a regular compose run to make sure I didn't break anything.
Reviewers: jskladan, jsedlak
Reviewed By: jsedlak
Subscribers: tflink
Differential Revision: https://phab.qa.fedoraproject.org/D1143
2017-01-25 16:16:12 +00:00
|
|
|
assert_script_run "sed -i -e 's,^metalink,#metalink,g' -e 's,^#baseurl,baseurl,g' /etc/yum.repos.d/fedora*.repo";
|
2017-03-13 19:43:54 +00:00
|
|
|
if (get_var("DEVELOPMENT")) {
|
2017-03-13 21:49:27 +00:00
|
|
|
# Fix URL for fedora.repo if this is a development release
|
|
|
|
# This is rather icky, but I can't think of any better way
|
|
|
|
# The problem is that the 'baseurl' line in fedora.repo is
|
|
|
|
# always left as the correct URL for a *stable* release, we
|
|
|
|
# don't change it to the URL for a Branched release while the
|
|
|
|
# release is Branched, as it's too much annoying package work
|
2017-03-13 19:43:54 +00:00
|
|
|
assert_script_run "sed -i -e 's,/releases/,/development/,g' /etc/yum.repos.d/fedora.repo";
|
2017-03-13 21:49:27 +00:00
|
|
|
# Disable updates-testing so other bad updates don't break us
|
|
|
|
assert_script_run "dnf config-manager --set-disabled updates-testing";
|
2017-03-13 19:43:54 +00:00
|
|
|
}
|
Add support for testing updates
Summary:
This adds an entirely new workflow for testing distribution
updates. The `ADVISORY` variable is introduced: when set,
`main.pm` will load an early post-install test that sets up
a repository containing the packages from the specified update,
runs `dnf -y update`, and reboots. A new templates file is
added, `templates-updates`, which adds two new flavors called
`updates-server` and `updates-workstation`, each containing
job templates for appropriate post-install tests. Scheduler is
expected to post `ADVISORY=(update ID) HDD_1=(base image)
FLAVOR=updates-(server|workstation)`, where (base image) is one
of the stable release base disk images produced by `createhdds`
and usually used for upgrade testing. This will result in the
appropriate job templates being loaded.
We rejig postinstall test loading and static network config a
bit so that this works for both the 'compose' and 'updates' test
flows: we have to ensure we bring up networking for the tap
tests before we try and install the updates, but still allow
later adjustment of the configuration. We take advantage of the
openQA feature that was added a few months back to run the same
module multiple times, so the `_advisory_update` module can
reboot after installing the updates and the modules that take
care of bootloader, encryption and login get run again. This
looks slightly wacky in the web UI, though - it doesn't show the
later runs of each module.
We also use the recently added feature to specify `+HDD_1` in
the test suites which use a disk image uploaded by an earlier
post-install test, so the test suite value will take priority
over the value POSTed by the scheduler for those tests, and we
will use the uploaded disk image (and not the clean base image
POSTed by the scheduler) for those tests.
My intent here is to enhance the scheduler, adding a consumer
which listens out for critpath updates, and runs this test flow
for each one, then reports the results to ResultsDB where Bodhi
could query and display them. We could also add a list of other
packages to have one or both sets of update tests run on it, I
guess.
Test Plan:
Try a post something like:
HDD_1=disk_f25_server_3_x86_64.img DISTRI=fedora VERSION=25
FLAVOR=updates-server ARCH=x86_64 BUILD=FEDORA-2017-376ae2b92c
ADVISORY=FEDORA-2017-376ae2b92c CURRREL=25 PREVREL=24
Pick an appropriate `ADVISORY` (ideally, one containing some
packages which might actually be involved in the tests), and
matching `FLAVOR` and `HDD_1`. The appropriate tests should run,
a repo with the update packages should be created and enabled
(and dnf update run), and the tests should work properly. Also
test a regular compose run to make sure I didn't break anything.
Reviewers: jskladan, jsedlak
Reviewed By: jsedlak
Subscribers: tflink
Differential Revision: https://phab.qa.fedoraproject.org/D1143
2017-01-25 16:16:12 +00:00
|
|
|
# Set up an additional repo containing the update packages. We do
|
|
|
|
# this rather than simply running a one-time update because it may
|
|
|
|
# be the case that a package from the update isn't installed *now*
|
|
|
|
# but will be installed by one of the tests; by setting up a repo
|
|
|
|
# containing the update and enabling it here, we ensure all later
|
|
|
|
# 'dnf install' calls will get the packages from the update.
|
|
|
|
assert_script_run "mkdir -p /opt/update_repo";
|
|
|
|
assert_script_run "cd /opt/update_repo";
|
|
|
|
assert_script_run "dnf -y install bodhi-client git createrepo", 300;
|
|
|
|
# download the packages
|
|
|
|
my $version = lc(get_var("VERSION"));
|
|
|
|
if ($version eq 'rawhide' || $version > 25) {
|
|
|
|
# bodhi client 2.x
|
2017-03-24 21:06:34 +00:00
|
|
|
assert_script_run "bodhi updates download --updateid " . get_var("ADVISORY"), 600;
|
Add support for testing updates
Summary:
This adds an entirely new workflow for testing distribution
updates. The `ADVISORY` variable is introduced: when set,
`main.pm` will load an early post-install test that sets up
a repository containing the packages from the specified update,
runs `dnf -y update`, and reboots. A new templates file is
added, `templates-updates`, which adds two new flavors called
`updates-server` and `updates-workstation`, each containing
job templates for appropriate post-install tests. Scheduler is
expected to post `ADVISORY=(update ID) HDD_1=(base image)
FLAVOR=updates-(server|workstation)`, where (base image) is one
of the stable release base disk images produced by `createhdds`
and usually used for upgrade testing. This will result in the
appropriate job templates being loaded.
We rejig postinstall test loading and static network config a
bit so that this works for both the 'compose' and 'updates' test
flows: we have to ensure we bring up networking for the tap
tests before we try and install the updates, but still allow
later adjustment of the configuration. We take advantage of the
openQA feature that was added a few months back to run the same
module multiple times, so the `_advisory_update` module can
reboot after installing the updates and the modules that take
care of bootloader, encryption and login get run again. This
looks slightly wacky in the web UI, though - it doesn't show the
later runs of each module.
We also use the recently added feature to specify `+HDD_1` in
the test suites which use a disk image uploaded by an earlier
post-install test, so the test suite value will take priority
over the value POSTed by the scheduler for those tests, and we
will use the uploaded disk image (and not the clean base image
POSTed by the scheduler) for those tests.
My intent here is to enhance the scheduler, adding a consumer
which listens out for critpath updates, and runs this test flow
for each one, then reports the results to ResultsDB where Bodhi
could query and display them. We could also add a list of other
packages to have one or both sets of update tests run on it, I
guess.
Test Plan:
Try a post something like:
HDD_1=disk_f25_server_3_x86_64.img DISTRI=fedora VERSION=25
FLAVOR=updates-server ARCH=x86_64 BUILD=FEDORA-2017-376ae2b92c
ADVISORY=FEDORA-2017-376ae2b92c CURRREL=25 PREVREL=24
Pick an appropriate `ADVISORY` (ideally, one containing some
packages which might actually be involved in the tests), and
matching `FLAVOR` and `HDD_1`. The appropriate tests should run,
a repo with the update packages should be created and enabled
(and dnf update run), and the tests should work properly. Also
test a regular compose run to make sure I didn't break anything.
Reviewers: jskladan, jsedlak
Reviewed By: jsedlak
Subscribers: tflink
Differential Revision: https://phab.qa.fedoraproject.org/D1143
2017-01-25 16:16:12 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
# bodhi client 0.9
|
2017-02-22 20:59:39 +00:00
|
|
|
# use git python-fedora for
|
|
|
|
# https://github.com/fedora-infra/python-fedora/pull/192
|
|
|
|
# until packages with that fix are pushed stable
|
Add support for testing updates
Summary:
This adds an entirely new workflow for testing distribution
updates. The `ADVISORY` variable is introduced: when set,
`main.pm` will load an early post-install test that sets up
a repository containing the packages from the specified update,
runs `dnf -y update`, and reboots. A new templates file is
added, `templates-updates`, which adds two new flavors called
`updates-server` and `updates-workstation`, each containing
job templates for appropriate post-install tests. Scheduler is
expected to post `ADVISORY=(update ID) HDD_1=(base image)
FLAVOR=updates-(server|workstation)`, where (base image) is one
of the stable release base disk images produced by `createhdds`
and usually used for upgrade testing. This will result in the
appropriate job templates being loaded.
We rejig postinstall test loading and static network config a
bit so that this works for both the 'compose' and 'updates' test
flows: we have to ensure we bring up networking for the tap
tests before we try and install the updates, but still allow
later adjustment of the configuration. We take advantage of the
openQA feature that was added a few months back to run the same
module multiple times, so the `_advisory_update` module can
reboot after installing the updates and the modules that take
care of bootloader, encryption and login get run again. This
looks slightly wacky in the web UI, though - it doesn't show the
later runs of each module.
We also use the recently added feature to specify `+HDD_1` in
the test suites which use a disk image uploaded by an earlier
post-install test, so the test suite value will take priority
over the value POSTed by the scheduler for those tests, and we
will use the uploaded disk image (and not the clean base image
POSTed by the scheduler) for those tests.
My intent here is to enhance the scheduler, adding a consumer
which listens out for critpath updates, and runs this test flow
for each one, then reports the results to ResultsDB where Bodhi
could query and display them. We could also add a list of other
packages to have one or both sets of update tests run on it, I
guess.
Test Plan:
Try a post something like:
HDD_1=disk_f25_server_3_x86_64.img DISTRI=fedora VERSION=25
FLAVOR=updates-server ARCH=x86_64 BUILD=FEDORA-2017-376ae2b92c
ADVISORY=FEDORA-2017-376ae2b92c CURRREL=25 PREVREL=24
Pick an appropriate `ADVISORY` (ideally, one containing some
packages which might actually be involved in the tests), and
matching `FLAVOR` and `HDD_1`. The appropriate tests should run,
a repo with the update packages should be created and enabled
(and dnf update run), and the tests should work properly. Also
test a regular compose run to make sure I didn't break anything.
Reviewers: jskladan, jsedlak
Reviewed By: jsedlak
Subscribers: tflink
Differential Revision: https://phab.qa.fedoraproject.org/D1143
2017-01-25 16:16:12 +00:00
|
|
|
assert_script_run "git clone https://github.com/fedora-infra/python-fedora.git";
|
2017-03-24 21:06:34 +00:00
|
|
|
assert_script_run "PYTHONPATH=python-fedora/ bodhi -D " . get_var("ADVISORY"), 600;
|
Add support for testing updates
Summary:
This adds an entirely new workflow for testing distribution
updates. The `ADVISORY` variable is introduced: when set,
`main.pm` will load an early post-install test that sets up
a repository containing the packages from the specified update,
runs `dnf -y update`, and reboots. A new templates file is
added, `templates-updates`, which adds two new flavors called
`updates-server` and `updates-workstation`, each containing
job templates for appropriate post-install tests. Scheduler is
expected to post `ADVISORY=(update ID) HDD_1=(base image)
FLAVOR=updates-(server|workstation)`, where (base image) is one
of the stable release base disk images produced by `createhdds`
and usually used for upgrade testing. This will result in the
appropriate job templates being loaded.
We rejig postinstall test loading and static network config a
bit so that this works for both the 'compose' and 'updates' test
flows: we have to ensure we bring up networking for the tap
tests before we try and install the updates, but still allow
later adjustment of the configuration. We take advantage of the
openQA feature that was added a few months back to run the same
module multiple times, so the `_advisory_update` module can
reboot after installing the updates and the modules that take
care of bootloader, encryption and login get run again. This
looks slightly wacky in the web UI, though - it doesn't show the
later runs of each module.
We also use the recently added feature to specify `+HDD_1` in
the test suites which use a disk image uploaded by an earlier
post-install test, so the test suite value will take priority
over the value POSTed by the scheduler for those tests, and we
will use the uploaded disk image (and not the clean base image
POSTed by the scheduler) for those tests.
My intent here is to enhance the scheduler, adding a consumer
which listens out for critpath updates, and runs this test flow
for each one, then reports the results to ResultsDB where Bodhi
could query and display them. We could also add a list of other
packages to have one or both sets of update tests run on it, I
guess.
Test Plan:
Try a post something like:
HDD_1=disk_f25_server_3_x86_64.img DISTRI=fedora VERSION=25
FLAVOR=updates-server ARCH=x86_64 BUILD=FEDORA-2017-376ae2b92c
ADVISORY=FEDORA-2017-376ae2b92c CURRREL=25 PREVREL=24
Pick an appropriate `ADVISORY` (ideally, one containing some
packages which might actually be involved in the tests), and
matching `FLAVOR` and `HDD_1`. The appropriate tests should run,
a repo with the update packages should be created and enabled
(and dnf update run), and the tests should work properly. Also
test a regular compose run to make sure I didn't break anything.
Reviewers: jskladan, jsedlak
Reviewed By: jsedlak
Subscribers: tflink
Differential Revision: https://phab.qa.fedoraproject.org/D1143
2017-01-25 16:16:12 +00:00
|
|
|
}
|
2017-02-22 20:59:39 +00:00
|
|
|
# log the exact packages in the update at test time, with their
|
|
|
|
# source packages and epochs. log is uploaded by _advisory_update
|
|
|
|
# and used for later comparison by _advisory_post
|
|
|
|
assert_script_run 'rpm -qp *.rpm --qf "%{SOURCERPM} %{EPOCH} %{NAME}-%{VERSION}-%{RELEASE}\n" | sort -u > /var/log/updatepkgs.txt';
|
Add support for testing updates
Summary:
This adds an entirely new workflow for testing distribution
updates. The `ADVISORY` variable is introduced: when set,
`main.pm` will load an early post-install test that sets up
a repository containing the packages from the specified update,
runs `dnf -y update`, and reboots. A new templates file is
added, `templates-updates`, which adds two new flavors called
`updates-server` and `updates-workstation`, each containing
job templates for appropriate post-install tests. Scheduler is
expected to post `ADVISORY=(update ID) HDD_1=(base image)
FLAVOR=updates-(server|workstation)`, where (base image) is one
of the stable release base disk images produced by `createhdds`
and usually used for upgrade testing. This will result in the
appropriate job templates being loaded.
We rejig postinstall test loading and static network config a
bit so that this works for both the 'compose' and 'updates' test
flows: we have to ensure we bring up networking for the tap
tests before we try and install the updates, but still allow
later adjustment of the configuration. We take advantage of the
openQA feature that was added a few months back to run the same
module multiple times, so the `_advisory_update` module can
reboot after installing the updates and the modules that take
care of bootloader, encryption and login get run again. This
looks slightly wacky in the web UI, though - it doesn't show the
later runs of each module.
We also use the recently added feature to specify `+HDD_1` in
the test suites which use a disk image uploaded by an earlier
post-install test, so the test suite value will take priority
over the value POSTed by the scheduler for those tests, and we
will use the uploaded disk image (and not the clean base image
POSTed by the scheduler) for those tests.
My intent here is to enhance the scheduler, adding a consumer
which listens out for critpath updates, and runs this test flow
for each one, then reports the results to ResultsDB where Bodhi
could query and display them. We could also add a list of other
packages to have one or both sets of update tests run on it, I
guess.
Test Plan:
Try a post something like:
HDD_1=disk_f25_server_3_x86_64.img DISTRI=fedora VERSION=25
FLAVOR=updates-server ARCH=x86_64 BUILD=FEDORA-2017-376ae2b92c
ADVISORY=FEDORA-2017-376ae2b92c CURRREL=25 PREVREL=24
Pick an appropriate `ADVISORY` (ideally, one containing some
packages which might actually be involved in the tests), and
matching `FLAVOR` and `HDD_1`. The appropriate tests should run,
a repo with the update packages should be created and enabled
(and dnf update run), and the tests should work properly. Also
test a regular compose run to make sure I didn't break anything.
Reviewers: jskladan, jsedlak
Reviewed By: jsedlak
Subscribers: tflink
Differential Revision: https://phab.qa.fedoraproject.org/D1143
2017-01-25 16:16:12 +00:00
|
|
|
# create the repo metadata
|
|
|
|
assert_script_run "createrepo .";
|
|
|
|
# write a repo config file
|
|
|
|
assert_script_run 'printf "[advisory]\nname=Advisory repo\nbaseurl=file:///opt/update_repo\nenabled=1\nmetadata_expire=3600\ngpgcheck=0" > /etc/yum.repos.d/advisory.repo';
|
|
|
|
# run an update now
|
2017-03-03 23:55:31 +00:00
|
|
|
script_run "dnf -y update", 600;
|
Add support for testing updates
Summary:
This adds an entirely new workflow for testing distribution
updates. The `ADVISORY` variable is introduced: when set,
`main.pm` will load an early post-install test that sets up
a repository containing the packages from the specified update,
runs `dnf -y update`, and reboots. A new templates file is
added, `templates-updates`, which adds two new flavors called
`updates-server` and `updates-workstation`, each containing
job templates for appropriate post-install tests. Scheduler is
expected to post `ADVISORY=(update ID) HDD_1=(base image)
FLAVOR=updates-(server|workstation)`, where (base image) is one
of the stable release base disk images produced by `createhdds`
and usually used for upgrade testing. This will result in the
appropriate job templates being loaded.
We rejig postinstall test loading and static network config a
bit so that this works for both the 'compose' and 'updates' test
flows: we have to ensure we bring up networking for the tap
tests before we try and install the updates, but still allow
later adjustment of the configuration. We take advantage of the
openQA feature that was added a few months back to run the same
module multiple times, so the `_advisory_update` module can
reboot after installing the updates and the modules that take
care of bootloader, encryption and login get run again. This
looks slightly wacky in the web UI, though - it doesn't show the
later runs of each module.
We also use the recently added feature to specify `+HDD_1` in
the test suites which use a disk image uploaded by an earlier
post-install test, so the test suite value will take priority
over the value POSTed by the scheduler for those tests, and we
will use the uploaded disk image (and not the clean base image
POSTed by the scheduler) for those tests.
My intent here is to enhance the scheduler, adding a consumer
which listens out for critpath updates, and runs this test flow
for each one, then reports the results to ResultsDB where Bodhi
could query and display them. We could also add a list of other
packages to have one or both sets of update tests run on it, I
guess.
Test Plan:
Try a post something like:
HDD_1=disk_f25_server_3_x86_64.img DISTRI=fedora VERSION=25
FLAVOR=updates-server ARCH=x86_64 BUILD=FEDORA-2017-376ae2b92c
ADVISORY=FEDORA-2017-376ae2b92c CURRREL=25 PREVREL=24
Pick an appropriate `ADVISORY` (ideally, one containing some
packages which might actually be involved in the tests), and
matching `FLAVOR` and `HDD_1`. The appropriate tests should run,
a repo with the update packages should be created and enabled
(and dnf update run), and the tests should work properly. Also
test a regular compose run to make sure I didn't break anything.
Reviewers: jskladan, jsedlak
Reviewed By: jsedlak
Subscribers: tflink
Differential Revision: https://phab.qa.fedoraproject.org/D1143
2017-01-25 16:16:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sub repo_setup {
|
|
|
|
# Run the appropriate sub-function for the job
|
|
|
|
get_var("ADVISORY") ? _repo_setup_updates : _repo_setup_compose;
|
2017-03-15 17:02:25 +00:00
|
|
|
# This repo does not always exist for Rawhide or Branched, and
|
|
|
|
# some things (at least realmd) try to update the repodata for
|
|
|
|
# it even though it is disabled, and fail. At present none of the
|
|
|
|
# tests needs it, so let's just unconditionally nuke it.
|
|
|
|
assert_script_run "rm -f /etc/yum.repos.d/fedora-cisco-openh264.repo";
|
Add support for testing updates
Summary:
This adds an entirely new workflow for testing distribution
updates. The `ADVISORY` variable is introduced: when set,
`main.pm` will load an early post-install test that sets up
a repository containing the packages from the specified update,
runs `dnf -y update`, and reboots. A new templates file is
added, `templates-updates`, which adds two new flavors called
`updates-server` and `updates-workstation`, each containing
job templates for appropriate post-install tests. Scheduler is
expected to post `ADVISORY=(update ID) HDD_1=(base image)
FLAVOR=updates-(server|workstation)`, where (base image) is one
of the stable release base disk images produced by `createhdds`
and usually used for upgrade testing. This will result in the
appropriate job templates being loaded.
We rejig postinstall test loading and static network config a
bit so that this works for both the 'compose' and 'updates' test
flows: we have to ensure we bring up networking for the tap
tests before we try and install the updates, but still allow
later adjustment of the configuration. We take advantage of the
openQA feature that was added a few months back to run the same
module multiple times, so the `_advisory_update` module can
reboot after installing the updates and the modules that take
care of bootloader, encryption and login get run again. This
looks slightly wacky in the web UI, though - it doesn't show the
later runs of each module.
We also use the recently added feature to specify `+HDD_1` in
the test suites which use a disk image uploaded by an earlier
post-install test, so the test suite value will take priority
over the value POSTed by the scheduler for those tests, and we
will use the uploaded disk image (and not the clean base image
POSTed by the scheduler) for those tests.
My intent here is to enhance the scheduler, adding a consumer
which listens out for critpath updates, and runs this test flow
for each one, then reports the results to ResultsDB where Bodhi
could query and display them. We could also add a list of other
packages to have one or both sets of update tests run on it, I
guess.
Test Plan:
Try a post something like:
HDD_1=disk_f25_server_3_x86_64.img DISTRI=fedora VERSION=25
FLAVOR=updates-server ARCH=x86_64 BUILD=FEDORA-2017-376ae2b92c
ADVISORY=FEDORA-2017-376ae2b92c CURRREL=25 PREVREL=24
Pick an appropriate `ADVISORY` (ideally, one containing some
packages which might actually be involved in the tests), and
matching `FLAVOR` and `HDD_1`. The appropriate tests should run,
a repo with the update packages should be created and enabled
(and dnf update run), and the tests should work properly. Also
test a regular compose run to make sure I didn't break anything.
Reviewers: jskladan, jsedlak
Reviewed By: jsedlak
Subscribers: tflink
Differential Revision: https://phab.qa.fedoraproject.org/D1143
2017-01-25 16:16:12 +00:00
|
|
|
}
|
|
|
|
|
2017-04-03 23:23:45 +00:00
|
|
|
sub gnome_initial_setup {
|
|
|
|
# Handle gnome-initial-setup, with variations for the pre-login
|
|
|
|
# mode (when no user was created during install) and post-login
|
|
|
|
# mode (when user was created during install)
|
|
|
|
my %args = (
|
|
|
|
prelogin => 0,
|
|
|
|
timeout => 120,
|
|
|
|
@_
|
|
|
|
);
|
|
|
|
my $nexts = 3;
|
|
|
|
if ($args{prelogin}) {
|
|
|
|
$nexts = 5;
|
|
|
|
}
|
|
|
|
assert_screen "next_button", $args{timeout};
|
|
|
|
# wait a bit in case of animation
|
|
|
|
wait_still_screen 3;
|
|
|
|
for my $n (1..$nexts) {
|
|
|
|
# click 'Next' $nexts times, moving the mouse to avoid
|
|
|
|
# highlight problems, sleeping to give it time to get
|
|
|
|
# to the next screen between clicks
|
|
|
|
mouse_set(100, 100);
|
|
|
|
wait_screen_change { assert_and_click "next_button"; };
|
|
|
|
# for Japanese, we need to workaround a bug on the keyboard
|
|
|
|
# selection screen
|
|
|
|
if ($n == 1 && get_var("LANGUAGE") eq 'japanese') {
|
|
|
|
if (!check_screen 'initial_setup_kana_kanji_selected', 5) {
|
|
|
|
record_soft_failure 'kana kanji not selected: bgo#776189';
|
|
|
|
assert_and_click 'initial_setup_kana_kanji';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
# click 'Skip' one time
|
|
|
|
mouse_set(100,100);
|
|
|
|
wait_screen_change { assert_and_click "skip_button"; };
|
|
|
|
send_key "ret";
|
|
|
|
if ($args{prelogin}) {
|
|
|
|
# create user
|
|
|
|
my $user_login = get_var("USER_LOGIN") || "test";
|
|
|
|
my $user_password = get_var("USER_PASSWORD") || "weakpassword";
|
|
|
|
type_very_safely $user_login;
|
|
|
|
wait_screen_change { assert_and_click "next_button"; };
|
|
|
|
type_very_safely $user_password;
|
|
|
|
send_key "tab";
|
|
|
|
type_very_safely $user_password;
|
|
|
|
wait_screen_change { assert_and_click "next_button"; };
|
|
|
|
send_key "ret";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
# wait for the stupid 'help' screen to show and kill it
|
|
|
|
assert_screen "getting_started";
|
|
|
|
send_key "alt-f4";
|
|
|
|
wait_still_screen 5;
|
|
|
|
# don't do it again on second load
|
|
|
|
}
|
|
|
|
set_var("_setup_done", 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
sub _type_user_password {
|
|
|
|
# convenience function used by anaconda_create_user, not meant
|
|
|
|
# for direct use
|
|
|
|
my $user_password = get_var("USER_PASSWORD") || "weakpassword";
|
|
|
|
if (get_var("SWITCHED_LAYOUT")) {
|
|
|
|
# we double the password, the second time using the native
|
|
|
|
# layout, so the password has both ASCII and native characters
|
|
|
|
desktop_switch_layout "ascii", "anaconda";
|
|
|
|
type_very_safely $user_password;
|
|
|
|
desktop_switch_layout "native", "anaconda";
|
|
|
|
type_very_safely $user_password;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
type_very_safely $user_password;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub anaconda_create_user {
|
|
|
|
# Create a user, in the anaconda interface. This is here because
|
|
|
|
# the same code works both during install and for initial-setup,
|
|
|
|
# which runs post-install, so we can share it.
|
|
|
|
my %args = (
|
|
|
|
timeout => 90,
|
|
|
|
@_
|
|
|
|
);
|
|
|
|
my $user_login = get_var("USER_LOGIN") || "test";
|
|
|
|
assert_and_click "anaconda_install_user_creation", '', $args{timeout};
|
|
|
|
assert_screen "anaconda_install_user_creation_screen";
|
|
|
|
# wait out animation
|
|
|
|
wait_still_screen 2;
|
|
|
|
type_very_safely $user_login;
|
|
|
|
type_very_safely "\t\t\t\t";
|
|
|
|
_type_user_password();
|
|
|
|
wait_screen_change { send_key "tab"; };
|
|
|
|
wait_still_screen 2;
|
|
|
|
_type_user_password();
|
|
|
|
# even with all our slow typing this still *sometimes* seems to
|
|
|
|
# miss a character, so let's try again if we have a warning bar.
|
|
|
|
# But not if we're installing with a switched layout, as those
|
|
|
|
# will *always* result in a warning bar at this point (see below)
|
|
|
|
if (!get_var("SWITCHED_LAYOUT") && check_screen "anaconda_warning_bar", 3) {
|
|
|
|
wait_screen_change { send_key "shift-tab"; };
|
|
|
|
wait_still_screen 2;
|
|
|
|
_type_user_password();
|
|
|
|
wait_screen_change { send_key "tab"; };
|
|
|
|
wait_still_screen 2;
|
|
|
|
_type_user_password();
|
|
|
|
}
|
|
|
|
assert_and_click "anaconda_install_user_creation_make_admin";
|
|
|
|
assert_and_click "anaconda_spoke_done";
|
|
|
|
# since 20170105, we will get a warning here when the password
|
|
|
|
# contains non-ASCII characters. Assume only switched layouts
|
|
|
|
# produce non-ASCII characters, though this isn't strictly true
|
|
|
|
if (get_var('SWITCHED_LAYOUT') && check_screen "anaconda_warning_bar", 3) {
|
|
|
|
wait_still_screen 1;
|
|
|
|
assert_and_click "anaconda_spoke_done";
|
|
|
|
}
|
|
|
|
}
|