1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-11-09 09:04:20 +00:00
os-autoinst-distri-fedora/tests/iot_rpmostree_rebase.pm
Adam Williamson 093da03139 Try and workaround IoT rebase problems with F37 read-only change
The change to read-only sysroot for IoT in F37 causes problems
with this rebase test. It's not supported to rebase from an RO
release (37 or 38) to a non-RO release (36). So we need to make
sure we don't try and do that. This uses some quick hack logic,
but it should be OK and sufficiently specific not to break
anything even if we forget to remove it in future.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2022-09-20 15:48:22 -07:00

77 lines
2.0 KiB
Perl

use base "installedtest";
use strict;
use testapi;
use utils;
sub run {
my $self = shift;
$self->root_console(tty => 3);
# list available branches
assert_script_run "ostree remote refs fedora-iot";
# check arch
my $arch = lc(get_var("ARCH"));
# set default for rawhide or devel
my $rebase = "stable";
# if testing the current release, rebase to devel
unless (script_run "rpm-ostree status -b | grep stable") {
$rebase = "devel";
}
# FIXME special cases for read-only transition from 36 to 37
# we can drop these (revert the whole relevant commit) once
# 37 is stable
my $orig;
if (get_var("CURRREL") eq "36") {
if (get_var("VERSION") eq "37") {
# rebase to rawhide
$rebase = "rawhide";
$orig = "devel";
}
elsif (get_var("VERSION") eq "38") {
# rebase to devel
$rebase = "devel";
$orig = "rawhide";
}
}
# rebase to the appropriate release, arch
validate_script_output "rpm-ostree rebase fedora/${rebase}/${arch}/iot", 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/$rebase/ }, 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, also account for branched (devel)
if ($orig) {
validate_script_output "rpm-ostree status -b", sub { m/$orig/ }, 300;
}
elsif ($rebase eq "devel") {
validate_script_output "rpm-ostree status -b", sub { m/stable/ }, 300;
}
elsif ($rebase eq "stable") {
validate_script_output "rpm-ostree status -b", sub { m/rawhide|devel/ }, 300;
}
}
sub test_flags {
return {fatal => 1};
}
1;
# vim: set sw=4 et: