1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2025-02-02 05:33:09 +00:00
os-autoinst-distri-fedora/tests/dnf5/swap.pm
2023-07-18 10:49:06 +02:00

46 lines
1.2 KiB
Perl

use base "installedtest";
use strict;
use testapi;
use utils;
use dnf;
# This script will make sure that DNF5 is able to
# swap (remove and install) two packages that are
# conflicting with each other, so we can install
# and remove them in one single command.
sub run {
my $self = shift;
# Install one package
assert_script_run("dnf5 install -y i3", timeout => 180);
# Check that the package is installed
assert_script_run("rpm -q i3");
# The I3 package requires the `i3-config` or `i3-config-fedora`
# to be installed. By default the first one should be installed.
# Let's check
assert_script_run("rpm -q i3-config");
# Try to install the `i3-config-fedora` package ->
# this time the operation should fail because the
# packages conflict with each other.
assert_script_run("! dnf5 install -y i3-config-fedora");
# Swap packages. The operation should run successfully.
assert_script_run("dnf5 swap -y i3-config i3-config-fedora", timeout => 180);
# Check that the first package was removed and the second installed.
assert_script_run("! rpm -q i3-config");
assert_script_run("rpm -q i3-config-fedora");
}
sub test_flags {
return {always_rollback => 1};
}
1;
# vim: set sw=4 et: