mirror of
https://github.com/rocky-linux/os-autoinst-distri-rocky.git
synced 2024-11-16 10:11:26 +00:00
dcb68d93c8
Summary: os-autoinst implements `script_run` itself now, we aren't required to implement it ourselves any more. os-autoinst's implementation is better than ours, as it allows for verifying the script actually ran (via the redirect-output-to-serial- console trick). So this drops our implementation so we'll just use the upstream one. Where I judged we don't want to bother with the 'check the command actually ran' feature I've adjusted our direct `script_run` calls to pass a wait time of 0, which skips the 'wait for command to run' stuff entirely and just does a simple 'type the string and hit enter'. Because of how the inheritance works, our `assert_script_run` calls already used the os-autoinst `script_run`, rather than the one from our distribution. This should prevent `prepare_test_packages` sometimes going wrong right after removing the python3-kickstart package, as we'll properly wait for that removal to complete now (before we weren't, we'd just start typing the next command while it was still running, which could result in lost keypresses). Test Plan: Check all tests still run OK (I've tried this on staging and it seems fine). Reviewers: jskladan, garretraziel Reviewed By: garretraziel Subscribers: tflink Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D1034
61 lines
2.2 KiB
Perl
61 lines
2.2 KiB
Perl
use base "installedtest";
|
|
use strict;
|
|
use testapi;
|
|
use main_common;
|
|
|
|
sub run {
|
|
my $self = shift;
|
|
# switch to TTY3 for both, graphical and console tests
|
|
$self->root_console(tty=>3);
|
|
# we could make this slightly more 'efficient' by assuming sshd
|
|
# is always going to be enabled/running at first, but it's safer
|
|
# to force an expected starting state.
|
|
script_run "systemctl stop sshd.service";
|
|
script_run "systemctl disable sshd.service";
|
|
script_run "reboot", 0;
|
|
boot_to_login_screen;
|
|
$self->root_console(tty=>3);
|
|
# note the use of ! here is a bash-ism, but it sure makes life easier
|
|
assert_script_run '! systemctl is-enabled sshd.service';
|
|
assert_script_run '! systemctl is-active sshd.service';
|
|
assert_script_run '! ps -C sshd';
|
|
script_run "systemctl start sshd.service";
|
|
assert_script_run '! systemctl is-enabled sshd.service';
|
|
assert_script_run 'systemctl is-active sshd.service';
|
|
assert_script_run 'ps -C sshd';
|
|
script_run "systemctl stop sshd.service";
|
|
assert_script_run '! systemctl is-enabled sshd.service';
|
|
assert_script_run '! systemctl is-active sshd.service';
|
|
assert_script_run '! ps -C sshd';
|
|
script_run "systemctl enable sshd.service";
|
|
assert_script_run 'systemctl is-enabled sshd.service';
|
|
assert_script_run '! systemctl is-active sshd.service';
|
|
assert_script_run '! ps -C sshd';
|
|
script_run "reboot", 0;
|
|
boot_to_login_screen;
|
|
$self->root_console(tty=>3);
|
|
assert_script_run 'systemctl is-enabled sshd.service';
|
|
assert_script_run 'systemctl is-active sshd.service';
|
|
assert_script_run 'ps -C sshd';
|
|
script_run "systemctl disable sshd.service";
|
|
script_run "reboot", 0;
|
|
boot_to_login_screen;
|
|
$self->root_console(tty=>3);
|
|
assert_script_run '! systemctl is-enabled sshd.service';
|
|
assert_script_run '! systemctl is-active sshd.service';
|
|
assert_script_run '! ps -C sshd';
|
|
}
|
|
|
|
|
|
sub test_flags {
|
|
# without anything - rollback to 'lastgood' snapshot if failed
|
|
# 'fatal' - whole test suite is in danger if this fails
|
|
# 'milestone' - after this test succeeds, update 'lastgood'
|
|
# 'important' - if this fails, set the overall state to 'fail'
|
|
return { fatal => 1 };
|
|
}
|
|
|
|
1;
|
|
|
|
# vim: set sw=4 et:
|