os-autoinst-distri-fedora/tests/_console_wait_login.pm

46 lines
1.3 KiB
Perl
Raw Normal View History

use base "installedtest";
use strict;
use testapi;
use utils;
sub run {
create fedora base class, factor out console login Summary: Root console in anaconda got broken by RHBZ #1222413 - no shell on tty2. Decided to clean up console use in general as part of fixing it. This creates a class 'fedorabase' and has 'anacondalog' and 'fedoralog' both inherit from it. boot_to_login_screen is moved there (as it seems appropriate) and it has a new method, console_login, which basically handles 'get me a shell on a console': if we're already at one it returns, if not it'll type the user name and the password *if necessary* (sometimes it's not) and return once it sees a prompt. It takes a hash of named parameters for user, password and 'check', which is whether it should die if it fails to reach a console or not (some users don't want it to). anacondalog and fedoralog both get 'root_console' methods which do something appropriate and then call console_login; both have a hash of named parameters, anacondalog's version only bothers with 'check', while fedoralog's also accepts 'tty' to pick the tty to use. This also adjusts all things which try to get to a console prompt to use either root_console or console_login as appropriate. It also tweaks the needle tags a bit, drops some unneeded needles, and adds a new 'user console prompt' needle; we really just need two versions of the root prompt needle and two of the user prompt needle (one for <F23, one for F23+ - the console font changed in F23, and the @ character at least doesn't match between the two). I think we still need the <F23 case for upgrade tests, for now. Test Plan: Do a full test run and see that more tests succeed. I've done a run on happyassassin with a hack to workaround the SELinux issue for interactive installs, and the results look good. I also fiddled about a bit to test some different cases, like forcing a failure in a live test to test post_fail_hook (and hence root_console) in that scenario, and forcing failures after some console commands had been run to check that it DTRT when we've already reached a console, etc. Reviewers: jskladan, garretraziel Reviewed By: jskladan, garretraziel Subscribers: tflink Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D462
2015-07-22 18:24:40 +00:00
my $self = shift;
# If UPGRADE is set, we have to wait for the entire upgrade
my $wait_time = 300;
$wait_time = 6000 if (get_var("UPGRADE"));
add a cockpit realmd FreeIPA join test Summary: This requires a few other changes: * turn clone_host_resolv into clone_host_file, letting you clone any given host file (cloning /etc/hosts seems to make both server deployment and client enrolment faster/more reliable) * allow loading of multiple POSTINSTALL tests (so we can share the freeipa_client_postinstall test). Note this is compatible, existing uses will work fine * move initial password change for the IPA test users into the server deployment test (so the client tests don't conflict over doing that) * add GRUB_POSTINSTALL, for specifying boot parameters for boot of the installed system, and make it work by tweaking _console_wait _login (doesn't work for _graphical_wait_login yet, as I didn't need that) * make the static networking config for tap tests into a library function so the tests can share it * handle ABRT problem dirs showing up in /var/spool/abrt as well as /var/tmp/abrt (because the enrol attempt hits #1330766 and the crash report shows up in /var/spool/abrt, don't ask me why the difference, I just work here) * specify the DNS servers from the worker host's resolv.conf as the forwarders for the FreeIPA server when deploying it; if we don't do this, rolekit defaults to using the root servers as forwarders(!) and thus we get the public, not phx2-appropriate, results for e.g. mirrors.fedoraproject.org, some of which the workers can't reach, so PackageKit package install always fails (boy, was it fun figuring THAT mess out) Even after all that, the test still doesn't actually pass, but I'm reasonably confident this is because it's hitting actual bugs, not because it's broken. It runs into #1330766 nearly every time (I think I saw *one* time the enrolment actually succeeded), and seems to run into a subsequent bug I hadn't seen before when trying to work around that by trying the join again (see https://bugzilla.redhat.com/show_bug.cgi?id=1330766#c37 ). Test Plan: Run the test, see what happens. If you're really lucky, it'll actually pass. But you'll probably run into #1330766#c37, I'm mostly posting for comment. You'll need a tap-capable openQA instance to test this. Reviewers: jskladan, garretraziel Reviewed By: garretraziel Subscribers: tflink Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D880
2016-06-07 20:00:39 +00:00
# handle bootloader, if requested
if (get_var("GRUB_POSTINSTALL")) {
do_bootloader(postinstall => 1, params => get_var("GRUB_POSTINSTALL"), timeout => $wait_time);
$wait_time = 240;
add a cockpit realmd FreeIPA join test Summary: This requires a few other changes: * turn clone_host_resolv into clone_host_file, letting you clone any given host file (cloning /etc/hosts seems to make both server deployment and client enrolment faster/more reliable) * allow loading of multiple POSTINSTALL tests (so we can share the freeipa_client_postinstall test). Note this is compatible, existing uses will work fine * move initial password change for the IPA test users into the server deployment test (so the client tests don't conflict over doing that) * add GRUB_POSTINSTALL, for specifying boot parameters for boot of the installed system, and make it work by tweaking _console_wait _login (doesn't work for _graphical_wait_login yet, as I didn't need that) * make the static networking config for tap tests into a library function so the tests can share it * handle ABRT problem dirs showing up in /var/spool/abrt as well as /var/tmp/abrt (because the enrol attempt hits #1330766 and the crash report shows up in /var/spool/abrt, don't ask me why the difference, I just work here) * specify the DNS servers from the worker host's resolv.conf as the forwarders for the FreeIPA server when deploying it; if we don't do this, rolekit defaults to using the root servers as forwarders(!) and thus we get the public, not phx2-appropriate, results for e.g. mirrors.fedoraproject.org, some of which the workers can't reach, so PackageKit package install always fails (boy, was it fun figuring THAT mess out) Even after all that, the test still doesn't actually pass, but I'm reasonably confident this is because it's hitting actual bugs, not because it's broken. It runs into #1330766 nearly every time (I think I saw *one* time the enrolment actually succeeded), and seems to run into a subsequent bug I hadn't seen before when trying to work around that by trying the join again (see https://bugzilla.redhat.com/show_bug.cgi?id=1330766#c37 ). Test Plan: Run the test, see what happens. If you're really lucky, it'll actually pass. But you'll probably run into #1330766#c37, I'm mostly posting for comment. You'll need a tap-capable openQA instance to test this. Reviewers: jskladan, garretraziel Reviewed By: garretraziel Subscribers: tflink Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D880
2016-06-07 20:00:39 +00:00
}
# handle initial-setup, if we're expecting it (ARM disk image)
if (get_var("INSTALL_NO_USER")) {
console_initial_setup;
}
# Wait for the text login
consolidate login waits, use postinstall not entrypoint for base Summary: I started out wanting to fix an issue I noticed today where graphical upgrade tests were failing because they didn't wait for the graphical login screen properly; the test was sitting at the 'full Fedora logo' state of plymouth for a long time, so the current boot_to_login_screen's wait_still_screen was triggered by it and the function wound up failing on the assert_screen, because it was still some time before the real login screen appeared. So I tweaked the boot_to_login_screen implementation to work slightly differently (look for a login screen match, *then* - if we're dealing with a graphical login - wait_still_screen to defeat the 'old GPU buffer showing login screen' problem and assert the login screen again). But while working on it, I figured we really should consolidate all the various places that handle the bootloader -> login, we were doing it quite differently in all sorts of different places. And as part of that, I converted the base tests to use POSTINSTALL (and thus go through the shared _wait_login tests) instead of handling boot themselves. As part of *that*, I tweaked main.pm to not require all POSTINSTALL tests have the _postinstall suffix on their names, as it really doesn't make sense, and renamed the tests. Test Plan: Run all tests, see if they work. Reviewers: jskladan, garretraziel Reviewed By: garretraziel Subscribers: tflink Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D1015
2016-09-27 18:48:15 +00:00
boot_to_login_screen(timeout => $wait_time);
# do user login unless USER_LOGIN is set to string 'false'
unless (get_var("USER_LOGIN") eq "false") {
# this avoids us waiting 90 seconds for a # to show up
my $origprompt = $testapi::distri->{serial_term_prompt};
$testapi::distri->{serial_term_prompt} = '$ ';
console_login(user => get_var("USER_LOGIN", "test"), password => get_var("USER_PASSWORD", "weakpassword"));
$testapi::distri->{serial_term_prompt} = $origprompt;
}
create fedora base class, factor out console login Summary: Root console in anaconda got broken by RHBZ #1222413 - no shell on tty2. Decided to clean up console use in general as part of fixing it. This creates a class 'fedorabase' and has 'anacondalog' and 'fedoralog' both inherit from it. boot_to_login_screen is moved there (as it seems appropriate) and it has a new method, console_login, which basically handles 'get me a shell on a console': if we're already at one it returns, if not it'll type the user name and the password *if necessary* (sometimes it's not) and return once it sees a prompt. It takes a hash of named parameters for user, password and 'check', which is whether it should die if it fails to reach a console or not (some users don't want it to). anacondalog and fedoralog both get 'root_console' methods which do something appropriate and then call console_login; both have a hash of named parameters, anacondalog's version only bothers with 'check', while fedoralog's also accepts 'tty' to pick the tty to use. This also adjusts all things which try to get to a console prompt to use either root_console or console_login as appropriate. It also tweaks the needle tags a bit, drops some unneeded needles, and adds a new 'user console prompt' needle; we really just need two versions of the root prompt needle and two of the user prompt needle (one for <F23, one for F23+ - the console font changed in F23, and the @ character at least doesn't match between the two). I think we still need the <F23 case for upgrade tests, for now. Test Plan: Do a full test run and see that more tests succeed. I've done a run on happyassassin with a hack to workaround the SELinux issue for interactive installs, and the results look good. I also fiddled about a bit to test some different cases, like forcing a failure in a live test to test post_fail_hook (and hence root_console) in that scenario, and forcing failures after some console commands had been run to check that it DTRT when we've already reached a console, etc. Reviewers: jskladan, garretraziel Reviewed By: jskladan, garretraziel Subscribers: tflink Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D462
2015-07-22 18:24:40 +00:00
if (get_var("ROOT_PASSWORD")) {
console_login(user => "root", password => get_var("ROOT_PASSWORD"));
}
}
sub test_flags {
return {fatal => 1};
}
1;
# vim: set sw=4 et: