mirror of
https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git
synced 2024-12-01 17:53:08 +00:00
104 lines
3.3 KiB
Perl
104 lines
3.3 KiB
Perl
use base "installedtest";
|
|
use strict;
|
|
use testapi;
|
|
use utils;
|
|
use dnf;
|
|
|
|
# This script follows the basic_sanity test as described
|
|
# https://fedoraproject.org/wiki/QA:Testcase_DNF_basic_sanity
|
|
|
|
|
|
# We select some packages and we'll do the installation tests.
|
|
sub run {
|
|
my $self = shift;
|
|
my @packages = ("fortune-mod", "mc", "cowsay", "python3-ipython");
|
|
|
|
# Install packages.
|
|
for my $package (@packages) {
|
|
install($package);
|
|
# Check if installed
|
|
die("$package not installed") unless (check($package));
|
|
}
|
|
|
|
# Remove packages.
|
|
for my $package (@packages) {
|
|
remove($package);
|
|
# Check if removed
|
|
die("$package not removed") if (check($package));
|
|
}
|
|
|
|
# Reinstall package.
|
|
#
|
|
# We will install elinks again and check that
|
|
# its executable is present on the system.
|
|
# Then we will delete the executable and check
|
|
# that it is not on the system any more.
|
|
# Then we will reinstall the package and check
|
|
# that everything is ok again.
|
|
install("elinks");
|
|
# Check that it is there
|
|
assert_script_run("which elinks");
|
|
# Remove the elinks executable
|
|
assert_script_run("rm -f /usr/bin/elinks");
|
|
# Check again for non-existence
|
|
assert_script_run("! which elinks");
|
|
# Reinstall
|
|
reinstall("elinks");
|
|
# Check once more for existence
|
|
assert_script_run("which elinks");
|
|
|
|
# Download package
|
|
# Create a download directory and cd into it.
|
|
assert_script_run("mkdir /download && cd /download");
|
|
assert_script_run("rm -f *");
|
|
# Download the package
|
|
assert_script_run("dnf5 download -y mc");
|
|
# Check that the rpm file has been downloaded
|
|
assert_script_run("ls mc*.rpm");
|
|
# Remove everything
|
|
assert_script_run("rm -f *");
|
|
|
|
# Download package and its dependencies
|
|
# Download the package
|
|
if (script_run("dnf5 download -y --resolve mc")) {
|
|
# FIXME: Currently, this command will result in an error, because the --resolve command
|
|
# does not work as expected. Bug has been reported.
|
|
record_soft_failure("Bug already reported: https://bugzilla.redhat.com/show_bug.cgi?id=2187981");
|
|
}
|
|
else {
|
|
# Check that the rpm files have been downloaded
|
|
assert_script_run("ls mc*.rpm");
|
|
assert_script_run("ls slang*.rpm");
|
|
}
|
|
# Remove the downloaded packages.
|
|
assert_script_run("rm -f *");
|
|
|
|
# Download package and all dependencies. There should
|
|
# be more than 200 files downloaded.
|
|
# Download the packages
|
|
if (script_run("dnf5 download -y --resolve --alldeps mc")) {
|
|
# See above.
|
|
record_soft_failure("Bug already reported: https://bugzilla.redhat.com/show_bug.cgi?id=2187981");
|
|
}
|
|
else {
|
|
# Check that the rpm files have been downloaded, but we will
|
|
# not be doing an exact comparison of all the dependencies,
|
|
# because they might vary through time. Instead, we will only
|
|
# check that a reasonably big number of rpms have been downloaded.
|
|
my $package_count = script_output("ls | wc -l");
|
|
if ($package_count < 200) {
|
|
die("The count of all dependencies is less than expected.");
|
|
}
|
|
}
|
|
# Remove everything
|
|
assert_script_run("rm -f *");
|
|
}
|
|
|
|
sub test_flags {
|
|
return {always_rollback => 1};
|
|
}
|
|
|
|
1;
|
|
|
|
# vim: set sw=4 et:
|