1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-12-11 05:43:11 +00:00
os-autoinst-distri-fedora/tests/dnf5/repoquery.pm

58 lines
2.1 KiB
Perl
Raw Normal View History

2023-04-18 08:56:59 +00:00
use base "installedtest";
use strict;
use testapi;
use utils;
use dnf;
# This script will make sure that DNF5 is able to
# perform several repoquery searches.
# https://fedoraproject.org/wiki/QA:Testcase_DNF_repoquery
# As of now, the test is based on the examples of
# the repoquery command stated in the DNF documentation
# at https://dnf.readthedocs.io/en/latest/command_ref.html#repoquery-command
# With DNF5 many options are still not implemented. We can add more
# querries and commands as needed later.
sub run {
my $self = shift;
# Let's take the total number of available packages in the repos.
my $total = script_output("dnf5 repoquery | wc -l", timeout => 60);
# The number of packages in default repositories is above 70000,
# so if the $total lies there, we could assume that the command
# returned something reasonable and thus works correctly:
if ($total < 10000) {
die("The number of packages is unrealistically low.");
}
elsif ($total < 70000) {
record_soft_failure("The number of packages is lower than we expected (70000).");
}
# Let's check the repoquery can be limited with a search pattern.
my $output = script_output("dnf5 repoquery 'light*'", timeout => 60);
confirm_in_lines($output, "light");
$output = script_output("dnf5 repoquery '*.noarch'", timeout => 60);
confirm_in_lines($output, "noarch");
# Let's check the repoquery can show what a meta package provides.
$output = script_output("dnf repoquery --whatprovides webserver", timeout => 60);
my @keywords = qw(caddy httpd lighttpd nginx);
# Check that correct packages are returned.
confirm_in_output($output, \@keywords);
# Let's check the repoquery can show what a package requires.
$output = script_output("dnf repoquery --requires lighttpd", timeout => 60);
@keywords = qw(libcrypt libnettle libuuid lighttpd-filesystems systemd);
# Check that correct packages are returned.
confirm_in_output($output, \@keywords);
}
sub test_flags {
return {always_rollback => 1};
}
1;
# vim: set sw=4 et: