mirror of
https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git
synced 2025-02-08 16:43:13 +00:00
47 lines
1.3 KiB
Perl
47 lines
1.3 KiB
Perl
use base "installedtest";
|
|
use strict;
|
|
use testapi;
|
|
use utils;
|
|
use dnf;
|
|
|
|
# This script will make sure that DNF5 is able to
|
|
# clean cache and recreate it according to
|
|
# https://fedoraproject.org/wiki/QA:Testcase_DNF_makecache_and_clean.
|
|
|
|
|
|
sub run {
|
|
my $self = shift;
|
|
|
|
# The cache should be clean at this moment, so we will
|
|
# check that there are no records in libdnf5 directory.
|
|
#
|
|
# We will create the cache and check that the data is
|
|
# there.
|
|
assert_script_run("dnf5 -y makecache");
|
|
# We will see how many lines there are in the
|
|
# directory listings when metadata is present.
|
|
my $metadata = script_output("ls /var/cache/libdnf5/* | wc -l");
|
|
#
|
|
# We will clean the metadata.
|
|
assert_script_run("dnf5 -y clean metadata");
|
|
# And we will check again. Now, the metadata
|
|
# count should be much less, because the
|
|
# directories should be empty.
|
|
my $postdelete = script_output("ls /var/cache/libdnf5/* | wc -l");
|
|
if ($postdelete >= $metadata) {
|
|
die("The created metadata had $metadata lines and after deletion they have $postdelete.");
|
|
}
|
|
|
|
# We will clean everything again.
|
|
assert_script_run("dnf5 -y clean all");
|
|
assert_script_run("! ls /var/cache/libdnf5/*");
|
|
}
|
|
|
|
sub test_flags {
|
|
return {always_rollback => 1};
|
|
}
|
|
|
|
1;
|
|
|
|
# vim: set sw=4 et:
|