FEATURE: Add DNF_CONTENTDIR override support ()

* add dnf_contentdir library function and implement is sample tests

* Short circuit auto addition of _console_wait_login for tests without DESKTOP

* support use of REPOSITORY_GRAPHICAL and ADD_REPOSITORY_GRAPHICAL test variables

* deprecate addition of dnf_contentdir lib function

* create and use get_version_major utility function

* resolve mismatch of login type caused by incorrect template entries

* add and use _staging_repos_enable post-install test

* add install_package_set_* tests only to package-set flavor

* fix variable re-declaration warning/error

* add rocky-getting-started-tour needles

* release rocky-repos content require switch from mirrorlist to baseurl

* implement DNF_CONTENTDIR swap as post-install action before reboot/login

* temp disable _staging_repos_enable

* incomplete fix for _graphical_wait_login
- get_release_number is used heavily in our openQA but makes no sense in 
Rocky. Multiple possible solutions but this one allows 
`_graphical_wait_login` to pass. NEEDS_WORK
This commit is contained in:
Trevor Cooper 2022-07-10 14:05:04 -07:00 committed by GitHub
parent 27cd94706b
commit 04c4a50c19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 237 additions and 68 deletions

View File

@ -368,9 +368,7 @@ sub get_full_repo {
if ($repourl !~ m/^(nfs|hd:)/) {
# Everything variant doesn't exist for modular composes atm,
# only Server
my $variant = 'Everything';
$variant = 'Server' if (get_var("MODULAR"));
$repourl .= "/${variant}/".get_var("ARCH")."/os";
$repourl .= "/".get_var("ARCH")."/os";
}
return $repourl;
}

View File

@ -8,7 +8,7 @@ use Exporter;
use feature "switch";
use lockapi;
use testapi;
our @EXPORT = qw/run_with_error_check type_safely type_very_safely desktop_vt boot_to_login_screen console_login console_switch_layout desktop_switch_layout console_loadkeys_us do_bootloader boot_decrypt check_release menu_launch_type repo_setup setup_workaround_repo cleanup_workaround_repo console_initial_setup handle_welcome_screen gnome_initial_setup anaconda_create_user check_desktop download_modularity_tests quit_firefox advisory_get_installed_packages advisory_check_nonmatching_packages start_with_launcher quit_with_shortcut lo_dismiss_tip disable_firefox_studies select_rescue_mode copy_devcdrom_as_isofile get_release_number get_code_name check_left_bar check_top_bar check_prerelease check_version spell_version_number _assert_and_click is_branched rec_log click_unwanted_notifications repos_mirrorlist register_application get_registered_applications solidify_wallpaper/;
our @EXPORT = qw/run_with_error_check type_safely type_very_safely desktop_vt boot_to_login_screen console_login console_switch_layout desktop_switch_layout console_loadkeys_us do_bootloader boot_decrypt check_release menu_launch_type repo_setup setup_workaround_repo cleanup_workaround_repo console_initial_setup handle_welcome_screen gnome_initial_setup anaconda_create_user check_desktop download_modularity_tests quit_firefox advisory_get_installed_packages advisory_check_nonmatching_packages start_with_launcher quit_with_shortcut lo_dismiss_tip disable_firefox_studies select_rescue_mode copy_devcdrom_as_isofile get_release_number get_version_major get_code_name check_left_bar check_top_bar check_prerelease check_version spell_version_number _assert_and_click is_branched rec_log click_unwanted_notifications repos_mirrorlist register_application get_registered_applications solidify_wallpaper/;
# We introduce this global variable to hold the list of applications that have
# registered during the apps_startstop_test when they have sucessfully run.
@ -63,12 +63,18 @@ sub get_release_number {
return $version
}
sub get_version_major {
my $version = get_var('VERSION');
my $version_major = substr($version, 0, index($version, q/./));
return $version_major
}
sub get_code_name {
my $code_name = 'Green Obsidian';
my $version = get_var('VERSION');
my $ver_major = substr($version, 0, index($version, q/./));
my $version_major = get_version_major;
given($ver_major){
given($version_major){
when ('9') { $code_name = 'Blue Onyx'; }
when ('10') { $code_name = 'Smoky Quartz'; }
when ('11') { $code_name = 'Lavender Calcite'; }
@ -605,7 +611,8 @@ sub _repo_setup_updates {
assert_script_run 'printf "[advisory]\nname=Advisory repo\nbaseurl=file:///opt/update_repo\nenabled=1\nmetadata_expire=3600\ngpgcheck=0" > /etc/yum.repos.d/advisory.repo';
# run an update now (except for upgrade tests)
my $relnum = get_release_number;
if ($relnum > 33) {
my $version_major = get_version_major;
if (($relnum > 33) || ($version_major > 8)) {
# FIXME workaround https://bugzilla.redhat.com/show_bug.cgi?id=1931034
# drop after https://github.com/systemd/systemd/pull/18915 is merged
# and stable
@ -953,7 +960,8 @@ sub start_with_launcher {
# but only after we hit 'down' twice to get into it.
# On F32 and earlier, it just scrolls vertically
my $relnum = get_release_number;
if ($relnum > 32) {
my $version_major = get_version_major;
if (($relnum > 32) || ($version_major > 8)) {
send_key 'down';
send_key 'down';
send_key_until_needlematch($launcher, 'right', 5, 6);

16
main.pm
View File

@ -249,12 +249,19 @@ sub _load_early_postinstall_tests {
# For now, there's no possibility to get a graphical desktop on
# Modular composes, so short-circuit here for those
if (get_var("MODULAR")) {
# Rocky has no such thing as MODULAR composes and we make use of PACKAGESET
# to select different Environments from the boot and/or DVD ISOs.
# DO NOT specify DESKTOP for minimal, server-product or virtualization-host
my $package_set = get_var("PACKAGE_SET");
if (!get_var("DESKTOP") || get_var("DESKTOP") eq "false" ||
$package_set eq "minimal" || $package_set eq "server" ||
$package_set eq "virtualization-host") {
_load_instance("tests/_console_wait_login", $instance);
return;
}
# Appropriate login method for install type
# Explicitly setting DESKTOP="kde" or DESKTOP="gnome" should ALWAYS trigger
# graphical login...
if (get_var("DESKTOP")) {
_load_instance("tests/_graphical_wait_login", $instance);
}
@ -284,6 +291,11 @@ sub load_postinstall_tests() {
# load the early tests
_load_early_postinstall_tests();
## enable staging repos if requested
#if (get_var("DNF_CONTENTDIR")) {
# autotest::loadtest "tests/_staging_repos_enable.pm";
#}
# do standard post-install static network config if the var is set
# and this is not an upgrade test (this is done elsewhere in the
# upgrade workflow)

View File

@ -0,0 +1,30 @@
{
"area": [
{
"height": 26,
"ypos": 41,
"width": 51,
"click_point": {
"xpos": 25.5,
"ypos": 13
},
"type": "match",
"xpos": 946
},
{
"xpos": 135,
"ypos": 6,
"width": 64,
"height": 23,
"type": "match"
}
],
"properties": [],
"tags": [
"DESKTOP-gnome",
"ENV-DISTRI-rocky",
"LANGUAGE-english",
"close_button",
"getting_started"
]
}

Binary file not shown.

After

(image error) Size: 48 KiB

View File

@ -0,0 +1,30 @@
{
"area": [
{
"width": 51,
"height": 26,
"ypos": 41,
"xpos": 946,
"type": "match",
"click_point": {
"xpos": 25.5,
"ypos": 13
}
},
{
"xpos": 135,
"type": "match",
"width": 64,
"height": 23,
"ypos": 6
}
],
"properties": [],
"tags": [
"DESKTOP-gnome",
"ENV-DISTRI-rocky",
"LANGUAGE-english",
"next_button",
"getting_started"
]
}

Binary file not shown.

After

(image error) Size: 35 KiB

View File

@ -0,0 +1,30 @@
{
"area": [
{
"width": 51,
"ypos": 41,
"height": 26,
"xpos": 946,
"click_point": {
"xpos": 25.5,
"ypos": 13
},
"type": "match"
},
{
"xpos": 135,
"type": "match",
"width": 64,
"ypos": 6,
"height": 23
}
],
"properties": [],
"tags": [
"DESKTOP-gnome",
"ENV-DISTRI-rocky",
"LANGUAGE-english",
"start_button",
"getting_started"
]
}

Binary file not shown.

After

(image error) Size: 46 KiB

View File

@ -0,0 +1,18 @@
{
"area": [
{
"xpos": 328,
"ypos": 490,
"width": 367,
"height": 65,
"type": "match"
}
],
"properties": [],
"tags": [
"DESKTOP-gnome",
"ENV-DISTRI-rocky",
"LANGUAGE-english",
"getting_started"
]
}

Binary file not shown.

After

(image error) Size: 190 KiB

View File

@ -494,6 +494,7 @@
"rocky-dvd-iso-x86_64-*-64bit": 10
},
"settings": {
"DESKTOP": "gnome",
"PACKAGE_SET": "default",
"POSTINSTALL": "_collect_data",
"STORE_HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2"
@ -623,83 +624,47 @@
},
"install_package_set_minimal": {
"profiles": {
"rocky-boot-iso-x86_64-*-64bit": 10,
"rocky-boot-iso-x86_64-*-uefi": 11,
"rocky-dvd-iso-x86_64-*-64bit": 11,
"rocky-dvd-iso-x86_64-*-uefi": 11,
"rocky-minimal-iso-x86_64-*-64bit": 10,
"rocky-universal-aarch64-*-aarch64": 30,
"rocky-universal-x86_64-*-64bit": 30,
"rocky-package-set-x86_64-*-64bit": 30
},
"settings": {
"PACKAGE_SET": "minimal",
"POSTINSTALL": "_console_login"
"DESKTOP": "false",
"PACKAGE_SET": "minimal"
}
},
"install_package_set_server": {
"profiles": {
"rocky-boot-iso-x86_64-*-64bit": 10,
"rocky-boot-iso-x86_64-*-uefi": 11,
"rocky-dvd-iso-x86_64-*-64bit": 11,
"rocky-dvd-iso-x86_64-*-uefi": 11,
"rocky-minimal-iso-x86_64-*-64bit": 10,
"rocky-universal-aarch64-*-aarch64": 30,
"rocky-package-set-x86_64-*-64bit": 30
},
"settings": {
"PACKAGE_SET": "server",
"POSTINSTALL": "_console_login"
"DESKTOP": "false",
"PACKAGE_SET": "server"
}
},
"install_package_set_graphical-server": {
"profiles": {
"rocky-boot-iso-x86_64-*-64bit": 10,
"rocky-boot-iso-x86_64-*-uefi": 11,
"rocky-dvd-iso-x86_64-*-64bit": 11,
"rocky-dvd-iso-x86_64-*-uefi": 11,
"rocky-universal-aarch64-*-aarch64": 30,
"rocky-package-set-x86_64-*-64bit": 30
},
"settings": {
"DESKTOP": "gnome",
"ENCRYPT_PASSWORD": "weakpassword",
"PACKAGE_SET": "graphical-server",
"POSTINSTALL": "_console_login",
"ROOT_PASSWORD": "weakpassword",
"USER_LOGIN": "qwerty"
"PACKAGE_SET": "graphical-server"
}
},
"install_package_set_workstation": {
"profiles": {
"rocky-boot-iso-x86_64-*-64bit": 10,
"rocky-boot-iso-x86_64-*-uefi": 11,
"rocky-dvd-iso-x86_64-*-64bit": 11,
"rocky-dvd-iso-x86_64-*-uefi": 11,
"rocky-universal-aarch64-*-aarch64": 30,
"rocky-package-set-x86_64-*-64bit": 30
},
"settings": {
"DESKTOP": "gnome",
"ENCRYPT_PASSWORD": "weakpassword",
"PACKAGE_SET": "workstation",
"POSTINSTALL": "_console_login",
"ROOT_PASSWORD": "weakpassword",
"USER_LOGIN": "qwerty"
"PACKAGE_SET": "workstation"
}
},
"install_package_set_virtualization-host": {
"profiles": {
"rocky-boot-iso-x86_64-*-64bit": 10,
"rocky-boot-iso-x86_64-*-uefi": 11,
"rocky-dvd-iso-x86_64-*-64bit": 11,
"rocky-dvd-iso-x86_64-*-uefi": 11,
"rocky-universal-aarch64-*-aarch64": 30,
"rocky-package-set-x86_64-*-64bit": 30
},
"settings": {
"PACKAGE_SET": "virtualization-host",
"POSTINSTALL": "_console_login"
"DESKTOP": "false",
"PACKAGE_SET": "virtualization-host"
}
},
"install_pxeboot": {

View File

@ -31,7 +31,7 @@ sub run {
$params .= "inst.repo=" . get_full_repo($repourl) . " ";
}
# Construct inst.addrepo arg for ADD_REPOSITORY_VARIATION
my $repourl = get_var("ADD_REPOSITORY_VARIATION");
$repourl = get_var("ADD_REPOSITORY_VARIATION");
if ($repourl) {
$params .= "inst.addrepo=addrepo," . get_full_repo($repourl) . " ";
}

View File

@ -73,7 +73,11 @@ sub run {
# trying to use the image itself as a repo and failing because it's
# not a DVD), and this was causing false failures when running
# universal tests on netinsts
if (get_var('FLAVOR') eq 'boot-iso') {
assert_script_run '! grep "base repo.*not valid" /tmp/packaging.log | grep -v "cdrom/file"';
} else {
script_run '! grep "base repo.*not valid" /tmp/packaging.log | grep -v "cdrom/file"';
}
}
# just for convenience - sometimes it's useful to see this log
# for a success case

View File

@ -140,6 +140,7 @@ sub run {
push (@actions, 'consoletty0') if (get_var("ARCH") eq "aarch64");
push (@actions, 'abrt') if (get_var("ABRT", '') eq "system");
push (@actions, 'rootpw') if (get_var("INSTALLER_NO_ROOT"));
push (@actions, 'stagingrepos') if (get_var("DNF_CONTENTDIR"));
# memcheck test doesn't need to reboot at all. Rebooting from GUI
# for lives is unreliable. And if we're already doing something
# else at a console, we may as well reboot from there too
@ -187,6 +188,20 @@ sub run {
my $root_password = get_var("ROOT_PASSWORD") || "weakpassword";
assert_script_run "echo 'root:$root_password' | chpasswd -R $mount";
}
if (grep {$_ eq 'stagingrepos'} @actions) {
if (get_version_major() < 9) {
assert_script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s,^#\(baseurl=http[s]*://\),\1,g" ' . $mount . '/etc/yum.repos.d/Rocky-BaseOS.repo';
assert_script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s,^#\(baseurl=http[s]*://\),\1,g" ' . $mount . '/etc/yum.repos.d/Rocky-AppStream.repo';
assert_script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s,^#\(baseurl=http[s]*://\),\1,g" ' . $mount . '/etc/yum.repos.d/Rocky-Extras.repo';
assert_script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s,^#\(baseurl=http[s]*://\),\1,g" ' . $mount . '/etc/yum.repos.d/Rocky-Devel.repo';
} else {
script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s/^#baseurl/baseurl/g" ' . $mount . '/etc/yum.repos.d/rocky.repo';
script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s/^#baseurl/baseurl/g" ' . $mount . '/etc/yum.repos.d/rocky-addons.repo';
script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s/^#baseurl/baseurl/g" ' . $mount . '/etc/yum.repos.d/rocky-devel.repo';
script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s/^#baseurl/baseurl/g" ' . $mount . '/etc/yum.repos.d/rocky-extras.repo';
}
assert_script_run 'printf "stg/rocky\n" > ' . $mount . '/etc/dnf/vars/contentdir';
}
type_string "reboot\n" if (grep {$_ eq 'reboot'} @actions);
}

View File

@ -5,7 +5,8 @@ use utils;
sub run {
my $relnum = get_release_number;
if (get_var("LANGUAGE") eq 'japanese' && $relnum > 33) {
my $version_major = get_version_major;
if (get_var("LANGUAGE") eq 'japanese' && (($relnum > 33) || ($version_major > 8))) {
# since g-i-s new user mode was dropped and the replacement
# doesn't do input method selection, and anaconda never has,
# we have to set up the input method manually:

View File

@ -65,7 +65,7 @@ sub run {
# GDM 3.24.1 dumps a cursor in the middle of the screen here...
mouse_hide;
if (get_var("DESKTOP") eq 'gnome') {
if ($version eq '9.0') {
if (get_version_major() > 8) {
send_key_until_needlematch("graphical_login_test_user_highlighted", "tab", 5);
assert_screen "graphical_login_test_user_highlighted";
}
@ -93,6 +93,8 @@ sub run {
send_key "ret";
}
# Welcome tour is here...
# For GNOME, handle initial-setup or welcome tour, unless START_AFTER_TEST
# is set in which case it will have been done already. Always
# do it if ADVISORY_OR_TASK is set, as for the update testing flow,
@ -101,9 +103,9 @@ sub run {
# as this test gets loaded twice on the ADVISORY_OR_TASK flow, and
# we might be on the INSTALL_NO_USER flow, check whether
# this happened already
my $relnum = get_release_number;
if ($relnum < 34) {
# before GNOME 40 (F34), we get a per-user version of
my $version_major = get_version_major();
if ($version_major < 9) {
# before GNOME 40 we get a per-user version of
# gnome-initial-setup here...
gnome_initial_setup() unless (get_var("_setup_done"));
}
@ -112,7 +114,7 @@ sub run {
handle_welcome_screen unless (get_var("_welcome_done"));
}
}
if ($version eq '9.0') {
if (get_version_major() > 8) {
handle_welcome_screen unless (get_var("_welcome_done"));
}
if (get_var("DESKTOP") eq 'gnome' && get_var("INSTALL_NO_USER")) {

View File

@ -0,0 +1,23 @@
use base "installedtest";
use strict;
use testapi;
use utils;
sub run {
my $self = shift;
$self->root_console(tty=>4);
# Point at default repositories by modifying contentdir
# NOTE: This will leave repos pointing at primary dl server instead
# of mirrorlist.
script_run 'printf "pub/rocky\n" > /etc/dnf/vars/contentdir';
script_run 'dnf clean all';
script_run 'dnf repoinfo'
}
sub test_flags {
return { fatal => 1 };
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,28 @@
use base "installedtest";
use strict;
use testapi;
use utils;
sub run {
my $self = shift;
$self->root_console(tty=>4);
# Point at staging repositories by modifying contentdir
if (get_version_major() < 9) {
script_run "sed -i 's/^mirrorlist/#mirrorlist/g' /etc/yum.repos.d/Rocky-*";
script_run "sed -i 's,^#\(baseurl=http[s]*://\),\1,g' /etc/yum.repos.d/Rocky-*";
} else {
script_run "sed -i 's/^mirrorlist/#mirrorlist/g' /etc/yum.repos.d/rocky*";
script_run "sed -i 's,^#\(baseurl=http[s]*://\),\1,g' /etc/yum.repos.d/rocky*";
}
script_run 'printf "stg/rocky\n" > /etc/dnf/vars/contentdir';
script_run 'dnf clean all';
script_run 'dnf repoinfo';
}
sub test_flags {
return { fatal => 1 };
}
1;
# vim: set sw=4 et:

View File

@ -157,7 +157,8 @@ sub reboot_system {
click_lastmatch;
if (match_has_tag("power_entry")) {
my $relnum = get_release_number;
if ($desktop eq "gnome" && $relnum < 33) {
my $version_major = get_version_major;
if ($desktop eq "gnome" && (($relnum < 33) || ($version_major < 9))) {
# In GNOME before F33, some of the entries are brought together, while
# in KDE and GNOME from F33 onwards they are split and it does not seem
# correct to me to assign restarting tags to needles powering off the

View File

@ -14,6 +14,7 @@ sub run {
my $self = shift;
my $desktop = get_var("DESKTOP");
my $relnum = get_release_number;
my $version_major = get_version_major;
# for the live image case, handle bootloader here
if (get_var("BOOTFROM")) {
do_bootloader(postinstall=>1, params=>'3');
@ -118,7 +119,7 @@ sub run {
}
}
if (get_var("BOOTFROM")) {
if ($desktop eq 'kde' && $relnum > 33) {
if ($desktop eq 'kde' && (($relnum > 33) || ($version_major > 8))) {
# there is not always a permanent notification in F34+,
# if we don't see one, check we saw the transient one
# earlier. FIXME: maybe drop the 'transient' path here

View File

@ -6,13 +6,14 @@ use utils;
sub run {
my $self = shift;
my $relnum = get_release_number;
my $version_major = get_version_major;
my $desktop = get_var("DESKTOP");
check_desktop;
menu_launch_type('terminal');
assert_screen "apps_run_terminal";
# FIXME: workaround for RHBZ#1957858 - test actually works without
# this, but very slowly as characters don't appear on screen
send_key "super-pgup" if ($relnum > 33 && $desktop eq "kde");
send_key "super-pgup" if ((($version_major > 8) || ($relnum > 33)) && $desktop eq "kde");
wait_still_screen 5;
# need to be root
my $rootpass = get_var("ROOT_PASSWORD", "weakpassword");

View File

@ -8,6 +8,7 @@ sub run {
my $self = shift;
my $desktop = get_var('DESKTOP');
my $relnum = get_release_number;
my $version_major = get_version_major;
# use a tty console for repo config and package prep
$self->root_console(tty=>3);
assert_script_run 'dnf config-manager --set-disabled updates-testing';
@ -22,7 +23,7 @@ sub run {
if ($desktop eq 'kde') {
# KDE team tells me until F34 the 'preferred' update method
# was the systray applet...
if ($relnum < 34) {
if (($relnum < 34) || ($version_major < 9)) {
# get rid of notifications which get in the way of the things
# we need to click
click_unwanted_notifications;

View File

@ -27,7 +27,8 @@ sub run {
# The next box we need to type into was moved in FreeIPA 4.8.9,
# which is in F32+ but not F31
my $relnum = get_release_number;
$relnum < 32 ? type_safely "\t\t" : type_safely "\t";
my $version_major = get_version_major;
(($relnum < 32) || ($version_major < 9)) ? type_safely "\t\t" : type_safely "\t";
type_safely "loremipsum";
wait_screen_change { send_key "tab"; };
type_safely "loremipsum";

View File

@ -106,7 +106,7 @@ sub run {
console_type_wait("3\n"); # set username
console_type_wait("$username\n");
# from Rawhide-20190503.n.0 (F31) onwards, 'use password' is default
if (get_release_number() < 31 && lc(get_var('DISTRI')) ne "rocky") {
if ((get_release_number() < 31) || (get_version_major() < 9)) {
# typing "4\n" on abrt screen causes system to reboot, so be careful
run_with_error_check(sub {console_type_wait("4\n")}, $error); # use password
}