os-autoinst-distri-fedora/tests/toolbox.pm

48 lines
1.8 KiB
Perl

use base "installedtest";
use strict;
use warnings;
use testapi;
sub run {
my $self = shift;
$self->root_console(tty => 3);
# on non-canned flavors, we need to install toolbox
assert_script_run "dnf -y install toolbox", 240 unless (get_var("CANNED"));
# check toolbox is installed
assert_script_run "rpm -q toolbox";
# check to see if you can create a new toolbox container
assert_script_run "toolbox create container1 -y", 300;
# check to see if toolbox can list container
validate_script_output "toolbox list | grep container1", sub { m/container1/ };
# run a specific command on a given container
validate_script_output "toolbox run --container container1 uname -a", sub { m/Linux toolbox/ };
# enter container to test
enter_cmd("toolbox enter container1");
validate_script_output("cat /etc/fedora-release", sub { m/Fedora release/ });
enter_cmd("exit");
sleep(2);
# Stop a conatiner
script_run 'podman stop container1';
# Toolbox remove container
assert_script_run "toolbox rm container1";
# Toolbox remove image and their dependant containers
assert_script_run "toolbox rmi --all --force";
# create a rhel image with distro and release flags
assert_script_run "toolbox create --distro rhel --release 9.1 -y", 300;
#run a specific command on a given choice of distro and release
#validate_script_output "toolbox run --distro rhel --release 9.1 cat /etc/redhat-release", sub { m/Red Hat Enterprise Linux release 9.1 (Plow)/ };
# validate rhel release file to ensure correct version
enter_cmd("toolbox enter rhel-toolbox-9.1");
validate_script_output("cat /etc/redhat-release", sub { m/Red Hat Enterprise Linux/ });
sleep(5);
}
sub test_flags {
return {fatal => 1};
}
1;
# vim: set sw=4 et