mirror of
https://github.com/rocky-linux/os-autoinst-distri-rocky.git
synced 2024-12-26 20:50:54 +00:00
a901fce4ab
Summary: again, added as a non-fatal module for realmd_join_cockpit as it's convenient to do it here. Also abstract a couple of ipa bits into a new exporter package in the style of SUSE's mm_network, rather than using ill-fitting class inheritance as we have before - we should probably convert our existing class based stuff to work this way. Also a few minor tweaks and clean-ups of the other tests: The path in console_login() where we detect login of a regular user when we want root or vice versa and log out was actually broken because it would 'wait' for the result of the 'exit' command, which obviously doesn't work (as it relies on running another command afterwards, and we're no longer at a shell). This commit no longer actually uses that path, but I spotted the bug with an earlier version of this which did, and we may as well keep the fix. /var/log/lastlog is an apparently-extremely-large sparse file. A couple of times it seemed to cause tar to run very slowly while creating the /var/log archive for upload on failure. It's no use for diagnosing bugs, so we may as well exclude it from the archive. I caught cockpit webUI login failing one time when testing the test, so threw in a wait_still_screen before starting to type the URL, as we have for the FreeIPA webUI. I also caught a timing issue with the openQA webUI policy add step; the test flips from the Users screen to the HBAC screen then clicks the 'add' button, but there's actually an identical 'add' button on *both* screens, so it could wind up trying to click the one on the Users screen instead, if the web UI took a few milliseconds to switch. So we throw in a needle match to make sure we're actually on the HBAC screen before clicking the button. We make the freeipa_webui test a 'milestone' so that if the new test fails, restoring to the last-known-good milestone doesn't take so long; it actually seems like openQA can get confused and try to cancel the test if restoring the milestone takes a *really* long time, and wind up with a zombie qemu process, which isn't good. This seems to avoid that happening. Test Plan: In the simple case, just run all the FreeIPA-related tests on Fedora 24 (as Rawhide is broken) and make sure they all work properly. To get a bit more advanced you can throw in an `assert_script_run 'false'` in either of the non-fatal tests to break it and make sure things go properly when that happens (the last milestone should be restored - which should be right after freeipa_webui, sitting at tty1 - and run properly; things are set up so each test starts with root logged in on tty1). Reviewers: jskladan, garretraziel Reviewed By: garretraziel Subscribers: tflink Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D935
92 lines
2.6 KiB
Perl
92 lines
2.6 KiB
Perl
package installedtest;
|
|
use base 'fedorabase';
|
|
|
|
# base class for tests that run on installed system
|
|
|
|
# should be used when with tests, where system is already installed, e. g all parts
|
|
# of upgrade tests, postinstall phases...
|
|
|
|
use testapi;
|
|
|
|
sub root_console {
|
|
my $self = shift;
|
|
my %args = (
|
|
tty => 1, # what TTY to login to
|
|
check => 1, # whether to fail when console wasn't reached
|
|
@_);
|
|
|
|
send_key "ctrl-alt-f$args{tty}";
|
|
$self->console_login(check=>$args{check});
|
|
}
|
|
|
|
sub post_fail_hook {
|
|
my $self = shift;
|
|
|
|
$self->root_console(tty=>2);
|
|
|
|
# If /var/tmp/abrt directory isn't empty (ls doesn't return empty string)
|
|
my $vartmp = script_output "ls /var/tmp/abrt";
|
|
if ($vartmp ne '') {
|
|
# Upload /var/tmp ABRT logs
|
|
script_run "cd /var/tmp/abrt && tar czvf tmpabrt.tar.gz *";
|
|
upload_logs "/var/tmp/abrt/tmpabrt.tar.gz";
|
|
}
|
|
my $varspool = script_output "ls /var/spool/abrt";
|
|
if ($varspool ne '') {
|
|
# Upload /var/spool ABRT logs
|
|
script_run "cd /var/spool/abrt && tar czvf spoolabrt.tar.gz *";
|
|
upload_logs "/var/spool/abrt/spoolabrt.tar.gz";
|
|
}
|
|
|
|
# Upload /var/log
|
|
# lastlog can mess up tar sometimes and it's not much use
|
|
script_run "tar czvf /tmp/var_log.tar.gz --exclude='lastlog' /var/log";
|
|
upload_logs "/tmp/var_log.tar.gz";
|
|
}
|
|
|
|
sub check_release {
|
|
my $self = shift;
|
|
my $release = shift;
|
|
my $check_command = "grep SUPPORT_PRODUCT_VERSION /usr/lib/os.release.d/os-release-fedora";
|
|
validate_script_output $check_command, sub { $_ =~ m/REDHAT_SUPPORT_PRODUCT_VERSION=$release/ };
|
|
}
|
|
|
|
sub menu_launch_type {
|
|
my $self = shift;
|
|
my $app = shift;
|
|
# super does not work on KDE, because fml
|
|
send_key 'alt-f1';
|
|
# srsly KDE y u so slo
|
|
wait_still_screen 3;
|
|
type_string "$app";
|
|
wait_still_screen 3;
|
|
send_key 'ret';
|
|
}
|
|
|
|
sub start_cockpit {
|
|
my $self = shift;
|
|
my $login = shift || 0;
|
|
# run firefox directly in X as root. never do this, kids!
|
|
type_string "startx /usr/bin/firefox\n";
|
|
assert_screen "firefox";
|
|
# open a new tab so we don't race with the default page load
|
|
# (also focuses the location bar for us)
|
|
send_key "ctrl-t";
|
|
wait_still_screen 2;
|
|
type_string "http://localhost:9090";
|
|
# firefox's stupid 'smart' url bar is a pain. wait for things to settle.
|
|
wait_still_screen 3;
|
|
send_key "ret";
|
|
assert_screen "cockpit_login";
|
|
if ($login) {
|
|
type_string "root";
|
|
send_key "tab";
|
|
type_string get_var("ROOT_PASSWORD", "weakpassword");
|
|
send_key "ret";
|
|
assert_screen "cockpit_main";
|
|
}
|
|
}
|
|
|
|
1;
|
|
|
|
# vim: set sw=4 et:
|