mirror of
https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git
synced 2025-02-27 09:24:31 +00:00
55 lines
1.7 KiB
Perl
55 lines
1.7 KiB
Perl
use base "installedtest";
|
|
use strict;
|
|
use testapi;
|
|
use utils;
|
|
use dnf;
|
|
|
|
# This script will make sure that DNF5 is able to
|
|
# perform repolist and repoquery --info transactions.
|
|
# https://fedoraproject.org/wiki/QA:Testcase_DNF_repoquery
|
|
# We will not rely on exact repositories in this test,
|
|
# but rather if there is some output and how big the
|
|
# output is. The repositories might change with various
|
|
# releases and this would break the tests.
|
|
|
|
|
|
sub run {
|
|
my $self = shift;
|
|
|
|
# Let's take the total number of available repositories.
|
|
my $total = script_output("dnf5 repolist --all | wc -l");
|
|
# The output has one description line in the beginning that
|
|
# we should not calculate into the total count of repositories,
|
|
# therefore:
|
|
$total -= 1;
|
|
|
|
# Now let's the number of enabled repositories
|
|
my $enabled = script_output("dnf5 repolist | wc -l");
|
|
$enabled -= 1; # See above
|
|
|
|
# And finally the number of disabled repositories
|
|
my $disabled = script_output("dnf5 repolist --disabled | wc -l");
|
|
$disabled -= 1; # See above
|
|
|
|
# It seems logical that enable plus disabled should make all.
|
|
my $added = $enabled + $disabled;
|
|
diag("There are $enabled enabled repos and $disabled repos and $total all repos.");
|
|
if ($added != $total) {
|
|
die("The addition of enabled and disabled repositories does not match the count of all repos.");
|
|
}
|
|
|
|
# Let's also check that at least 'fedora' and 'updates'
|
|
# are part of enabled repositories.
|
|
my $output = script_output("dnf5 repolist");
|
|
my @repos = qw(fedora updates);
|
|
confirm_in_output($output, \@repos);
|
|
}
|
|
|
|
sub test_flags {
|
|
return {always_rollback => 1};
|
|
}
|
|
|
|
1;
|
|
|
|
# vim: set sw=4 et:
|