1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-11-17 20:13:08 +00:00
os-autoinst-distri-fedora/tests/rpmostree_rebase.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

70 lines
1.9 KiB
Perl

use base "installedtest";
use strict;
use testapi;
use utils;
sub run {
my $self = shift;
$self->root_console(tty => 3);
# list available branches
my $subv = lc(get_var("SUBVARIANT"));
my $remote = "fedora";
$remote = "fedora-iot" if ($subv eq "iot");
assert_script_run "ostree remote refs $remote";
# get current branch
my $current = script_output "rpm-ostree status -b | grep fedora";
my $arch = lc(get_var("ARCH"));
# decide target
my $rebase;
my $target;
if ($current =~ "iot") {
$rebase = $current =~ "stable" ? "devel" : "stable";
$target = "fedora/${rebase}/${arch}/iot";
}
elsif ($current =~ "silverblue") {
my $relnum = get_release_number;
$rebase = $relnum - 1;
# avoid rebasing from 37 to <37, bad stuff happens
# FIXME when 38 branches, we should change this to RELNUM+1
$rebase = "rawhide" if ($relnum eq "37");
$target = "fedora/${rebase}/${arch}/silverblue";
}
elsif ($current =~ "coreos") {
$rebase = $current =~ "stable" ? "testing" : "stable";
$target = "fedora/${arch}/coreos/${rebase}";
}
# rebase to the chosen target
validate_script_output "rpm-ostree rebase $target", sub { m/systemctl reboot/ }, 300;
script_run "systemctl reboot", 0;
boot_to_login_screen;
$self->root_console(tty => 3);
# check booted branch to make sure successful rebase
validate_script_output "rpm-ostree status -b", sub { m/$target/ }, 300;
# rollback and reboot
validate_script_output "rpm-ostree rollback", sub { m/systemctl reboot/ }, 300;
script_run "systemctl reboot", 0;
boot_to_login_screen;
$self->root_console(tty => 3);
# check to make sure rollback successful
validate_script_output "rpm-ostree status -b", sub { m/$current/ }, 300;
}
sub test_flags {
return {fatal => 1};
}
1;
# vim: set sw=4 et: