1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-11-03 15:04:22 +00:00
os-autoinst-distri-fedora/lib/packagetest.pm
Adam Williamson baa7ac4e39 Handle KDE update test when KDE has aleady found updates
We do the 'desktop update' test for KDE via the notification
icon thingy, and it behaves differently depending on whether it
has already detected there are updates or not. The test only
works at present in the case where it *hasn't* - it expects the
notification icon to be in the extended panel and it expects to
see a 'refresh' button, neither of which is the case if it's
already noticed there are updates to install.

We should also force PackageKit to update its list of available
updates after we set up our 'special' update, otherwise on this
path KDE will only install the updates it found *before* we did
our stuff, and the test will fail as our special update won't be
there.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2018-03-28 19:53:19 -07:00

45 lines
1.8 KiB
Perl

package packagetest;
use strict;
use base 'Exporter';
use Exporter;
use testapi;
our @EXPORT = qw/prepare_test_packages verify_installed_packages verify_updated_packages/;
# enable the openqa test package repositories and install the main
# test packages, remove python3-kickstart and install the fake one
sub prepare_test_packages {
# remove python3-kickstart if installed (we don't use assert
# here in case it's not)
script_run 'dnf -y remove python3-kickstart', 180;
# we seem to often lose keystrokes in the next command if we run
# it too fast, let's wait for idle first
wait_idle 20;
# grab the test repo definitions
assert_script_run 'curl -o /etc/yum.repos.d/openqa-testrepo-1.repo https://fedorapeople.org/groups/qa/openqa-repos/openqa-testrepo-1.repo';
# install the test packages from repo1
assert_script_run 'dnf -y --disablerepo=* --enablerepo=openqa-testrepo-1 install python3-kickstart';
if (get_var("DESKTOP") eq 'kde' && get_var("TEST") eq 'desktop_update_graphical') {
# kick pkcon so our special update will definitely get installed
assert_script_run 'pkcon refresh force';
}
}
# check our test packages installed correctly (this is a test that dnf
# actually does what it claims)
sub verify_installed_packages {
validate_script_output 'rpm -q python3-kickstart', sub { $_ =~ m/^python3-kickstart-1.1.noarch$/ };
assert_script_run 'rpm -V python3-kickstart';
}
# check updating the test packages and the fake python3-kickstart work
# as expected
sub verify_updated_packages {
# we don't know what version of python3-kickstart we'll actually
# get, so just check it's *not* the fake one
validate_script_output 'rpm -q python3-kickstart', sub { $_ !~ m/^python3-kickstart-1-1.noarch$/ };
assert_script_run 'rpm -V python3-kickstart';
}