1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-11-25 07:13:09 +00:00

WIP make ostree tests generic, run on Silverblue

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2022-12-06 14:41:56 -08:00
parent 89faf008dd
commit cb0fcb58e0
6 changed files with 202 additions and 171 deletions

View File

@ -123,8 +123,8 @@
"settings": {
"CANNED": "1",
"DESKTOP": "gnome",
"DEPLOY_UPLOAD_TEST": "install_default_update_ostree",
"HDDSIZEGB": "15",
"NUMDISKS": "2",
"PACKAGE_SET": "default",
"RETRY": "1",
"SUBVARIANT": "Silverblue"
@ -400,7 +400,8 @@
"INSTALL": "1",
"ISO": "%ADVISORY_OR_TASK%-%SUBVARIANT%-ostree-%ARCH%.iso",
"PACKAGE_SET": "default",
"+START_AFTER_TEST": "ostree_build@%ARCH_BASE_MACHINE%"
"+START_AFTER_TEST": "ostree_build@%ARCH_BASE_MACHINE%",
"STORE_HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2"
}
},
"installer_build": {
@ -480,6 +481,16 @@
"fedora-updates-server-x86_64-*-64bit": 5
}
},
"rpmostree_overlay": {
"profiles": {
"fedora-updates-silverblue-dvd_ostree-iso-x86_64-*-64bit": 5
}
},
"rpmostree_rebase": {
"profiles": {
"fedora-updates-silverblue-dvd_ostree-iso-x86_64-*-64bit": 5
}
},
"server_cockpit_basic": {
"profiles": {
"fedora-updates-server-aarch64-*-aarch64": 5,

View File

@ -2120,33 +2120,6 @@
"START_AFTER_TEST": "%DEPLOY_UPLOAD_TEST%"
}
},
"iot_rpmostree_overlay": {
"profiles": {
"fedora-IoT-dvd_ostree-iso-aarch64-*-aarch64": 20,
"fedora-IoT-dvd_ostree-iso-x86_64-*-uefi": 20
},
"settings": {
"BOOTFROM": "c",
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
"POSTINSTALL": "iot_rpmostree_overlay",
"ROOT_PASSWORD": "weakpassword",
"START_AFTER_TEST": "%DEPLOY_UPLOAD_TEST%"
}
},
"iot_rpmostree_rebase": {
"profiles": {
"fedora-IoT-dvd_ostree-iso-aarch64-*-aarch64": 20,
"fedora-IoT-dvd_ostree-iso-x86_64-*-uefi": 40
},
"settings": {
"BOOTFROM": "c",
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
"POSTINSTALL": "iot_rpmostree_rebase",
"ROOT_PASSWORD": "weakpassword",
"START_AFTER_TEST": "%DEPLOY_UPLOAD_TEST%",
"USER_LOGIN": "false"
}
},
"iot_zezere_ignition": {
"profiles": {
"fedora-IoT-dvd_ostree-iso-aarch64-*-aarch64": 20,
@ -2346,6 +2319,39 @@
"USER_LOGIN": "false"
}
},
"rpmostree_overlay": {
"profiles": {
"fedora-CoreOS-colive-iso-x86_64-*-64bit": 20,
"fedora-IoT-dvd_ostree-iso-aarch64-*-aarch64": 20,
"fedora-IoT-dvd_ostree-iso-x86_64-*-uefi": 20,
"fedora-Silverblue-dvd_ostree-iso-ppc64le-*-ppc64le": 50,
"fedora-Silverblue-dvd_ostree-iso-x86_64-*-64bit": 50
},
"settings": {
"BOOTFROM": "c",
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
"POSTINSTALL": "rpmostree_overlay",
"ROOT_PASSWORD": "weakpassword",
"+START_AFTER_TEST": "%DEPLOY_UPLOAD_TEST%"
}
},
"rpmostree_rebase": {
"profiles": {
"fedora-CoreOS-colive-iso-x86_64-*-64bit": 20,
"fedora-IoT-dvd_ostree-iso-aarch64-*-aarch64": 20,
"fedora-IoT-dvd_ostree-iso-x86_64-*-uefi": 20,
"fedora-Silverblue-dvd_ostree-iso-ppc64le-*-ppc64le": 50,
"fedora-Silverblue-dvd_ostree-iso-x86_64-*-64bit": 50
},
"settings": {
"BOOTFROM": "c",
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
"POSTINSTALL": "rpmostree_rebase",
"ROOT_PASSWORD": "weakpassword",
"+START_AFTER_TEST": "%DEPLOY_UPLOAD_TEST%",
"USER_LOGIN": "false"
}
},
"server_cockpit_basic": {
"profiles": {
"fedora-Server-dvd-iso-aarch64-*-aarch64": 30,

View File

@ -1,81 +0,0 @@
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;
script_run "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);
# Install wget as rpm-ostree overlay. Let's have timeout defined
# quite generously, because it loads the package DBs.
assert_script_run "rpm-ostree install wget", timeout => 300;
# Reboot the machine to boot into the overlayed tree.
reboot_and_login "300";
# Check that wget rpm is installed
assert_script_run "rpm -q wget";
# And that it works
assert_script_run "wget --version";
# Then install the httpd package.
assert_script_run "rpm-ostree install httpd", 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 wget";
assert_script_run "rpm -q httpd";
assert_script_run "rpm -q apr";
# Start the httpd.service and check for its status
assert_script_run "systemctl start httpd";
assert_script_run "systemctl is-active httpd";
# Check for the functional test page
assert_script_run "curl -o page.html http://localhost";
assert_script_run "grep 'Fedora Project' page.html";
# Enable the httpd service
assert_script_run "systemctl enable httpd";
# Reboot the computer to boot check if the service has been enabled and starts
# automatically.
reboot_and_login "300";
# See if httpd is started
assert_script_run "systemctl is-active httpd";
# Uninstall wget and httpd again.
assert_script_run "rpm-ostree uninstall wget httpd", timeout => 300;
# Reboot to see the changed tree
reboot_and_login "300";
# Check if wget and httpd were removed and no longer can be used.
assert_script_run "! rpm -q wget";
assert_script_run "! rpm -q httpd";
assert_script_run "! wget --version";
assert_script_run "! systemctl is-active httpd";
}
sub test_flags {
return {fatal => 1};
}
1;
# vim: set sw=4 et:

View File

@ -1,61 +0,0 @@
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";
}
# 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
if ($rebase eq "devel") {
validate_script_output "rpm-ostree status -b", sub { m/devel/ }, 300;
}
if ($rebase eq "stable") {
validate_script_output "rpm-ostree status -b", sub { m/stable/ }, 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 ($rebase eq "devel") {
validate_script_output "rpm-ostree status -b", sub { m/stable/ }, 300;
}
if ($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:

View File

@ -0,0 +1,87 @@
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:

69
tests/rpmostree_rebase.pm Normal file
View File

@ -0,0 +1,69 @@
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: