1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-11-22 05:53:09 +00:00
os-autoinst-distri-fedora/tests/rpmostree_overlay.pm
Adam Williamson 6daf9c36a0 Make rpm-ostree tests generic, run on Silverblue and CoreOS
This makes the two rpm-ostree tests written for IoT - overlaying
and rebasing - work across all rpm-ostree-based flavors we
currently test (IoT, CoreOS and Silverblue) and runs them on
all those flavors.

This requires some other changes. For the Workstation ostree
installer update tests, we have install_default_update_ostree
upload a disk image and run these tests on that image. That means
install_default_update_ostree cannot use a scratch disk (as if
we boot it with two disks but only upload one, the subsequent
tests fail to boot, looking for the missing second disk), but its
specified disk size should be large enough for all updates.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2022-12-16 08:44:43 -08:00

88 lines
2.7 KiB
Perl

use base "installedtest";
use strict;
use testapi;
use utils;
sub reboot_and_login {
# This subroutine reboots the host, waits out the boot process and logs in.
my $reboot_time = shift;
enter_cmd "systemctl reboot";
boot_to_login_screen(timeout => $reboot_time);
console_login(user => "root", password => get_var("ROOT_PASSWORD"));
sleep 2;
}
sub run {
my $self = shift;
my $reboot_time = 300;
# switch to TTY3 for both, graphical and console tests
$self->root_console(tty => 3);
# disable graphical boot on graphical images
assert_script_run "systemctl set-default multi-user.target";
# Install htop as rpm-ostree overlay. Let's have timeout defined
# quite generously, because it loads the package DBs.
assert_script_run "rpm-ostree install htop", timeout => 300;
# Reboot the machine to boot into the overlayed tree.
reboot_and_login "300";
# Check that htop rpm is installed
assert_script_run "rpm -q htop";
# And that it works
assert_script_run "htop --version";
# Then install the psotgresql-server package.
assert_script_run "rpm-ostree install postgresql-server", timeout => 300;
# Reboot the machine to boot into the overlayed tree.
reboot_and_login "300";
# Check for new as well as old overlays
assert_script_run "rpm -q htop";
assert_script_run "rpm -q postgresql-server";
# this is a dependency of postgresql-server; check it's there
assert_script_run "rpm -q postgresql";
# init the db (required to be able to run the service)
assert_script_run "/usr/bin/postgresql-setup --initdb";
# Start the postgresql.service and check for its status
assert_script_run "systemctl start postgresql";
assert_script_run "systemctl is-active postgresql";
# Check it's working
assert_script_run 'su postgres -c "psql -l"';
# Enable the postgresql service
assert_script_run "systemctl enable postgresql";
# Reboot the computer to boot check if the service has been enabled and starts
# automatically.
reboot_and_login "300";
# See if postgresql is started
assert_script_run "systemctl is-active postgresql";
# Uninstall htop and postgresql again.
assert_script_run "rpm-ostree uninstall htop postgresql-server", timeout => 300;
# Reboot to see the changed tree
reboot_and_login "300";
# Check if htop and postgresql-server were removed and no longer can be used.
assert_script_run "! rpm -q htop";
assert_script_run "! rpm -q postgresql-server";
assert_script_run "! rpm -q postgresql";
assert_script_run "! htop --version";
assert_script_run "! systemctl is-active postgresql";
}
sub test_flags {
return {fatal => 1};
}
1;
# vim: set sw=4 et: