use base "installedtest"; use strict; use testapi; use utils; # The setup script for the DNF5 test suite. # # This script will test if DNF5 is installed on the system. # Currently, this is not the case, but later in the process, # so we will softfail if it is not and we will install it. # Later, when DNF5 is part of Fedora, we will fail instead. sub run { my $self = shift; # Switch to console $self->root_console(tty => 3); # Check that the package is installed. If it is not, # the following command will fail. if (script_run("rpm -q dnf5", timeout => 20)) { # FIXME: When DNF5 is part of Fedora, change this to die instead. record_soft_failure("The dnf5 package is not installed. I am installing it now."); # Install the package, so we can move forward. assert_script_run("dnf install -y dnf5 dnf5-plugins", timeout => 180); } else { # This is here as notice. When we are seeing this, DNF5 has become # the part of Fedora. record_info("DNF5 is already installed on the system."); } # Currently, DNF5 is being invoked by calling "dnf5". We assume, # that later it will be changed into "dnf" when DNF4 will be gone. my $dnfversion = script_output("dnf --version"); if ("dnf5" =~ $dnfversion) { record_info("DNF version", "The 'dnf' command uses version 5."); } else { record_info("DNF version", "The 'dnf' command uses version 4."); } } sub test_flags { return {fatal => 1, milestone => 1}; } 1; # vim: set sw=4 et: