mirror of
https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git
synced 2024-11-29 17:13:09 +00:00
63 lines
1.6 KiB
Perl
63 lines
1.6 KiB
Perl
use base "installedtest";
|
|
use strict;
|
|
use testapi;
|
|
use utils;
|
|
use dnf;
|
|
|
|
|
|
# This script tests if information can be display about a package.
|
|
# https://fedoraproject.org/wiki/QA:Testcase_DNF_info
|
|
# For this test we will parse a package NEVRA
|
|
# and then find out whether the package info matches
|
|
# the package.
|
|
|
|
sub run {
|
|
my $self = shift;
|
|
|
|
# Install the 'mc' package
|
|
assert_script_run("dnf5 install -y mc");
|
|
|
|
# Check that info can be listed about the last transaction.
|
|
my $errors = []; # This will be used to collect possible errors.
|
|
# Get the info output.
|
|
my $output = script_output("dnf5 info mc");
|
|
# Get the package name from the system.
|
|
my $pname = script_output("rpm -q mc");
|
|
|
|
|
|
my $info = parse_info($output);
|
|
my $package = parse_package_name($pname);
|
|
|
|
if ($info->{Name} ne $package->{name}) {
|
|
push(@$errors, "Package name differs.");
|
|
}
|
|
if ($info->{Version} ne $package->{version}) {
|
|
push(@$errors, "Package version differs.");
|
|
}
|
|
if ($info->{Release} ne $package->{release}) {
|
|
push(@$errors, "Package release differs.");
|
|
}
|
|
if ($info->{"Architecture"} ne $package->{arch}) {
|
|
push(@$errors, "Package architecture differs.");
|
|
}
|
|
|
|
# Now, go over the recorded errors and die if you
|
|
# find any.
|
|
my $ecount = scalar @$errors;
|
|
if ($ecount > 0) {
|
|
diag("DNF5 history info errors:");
|
|
foreach (@$errors) {
|
|
diag($_);
|
|
}
|
|
die("The info differs from what we expected");
|
|
}
|
|
}
|
|
|
|
sub test_flags {
|
|
return {always_rollback => 1};
|
|
}
|
|
|
|
1;
|
|
|
|
# vim: set sw=4 et:
|