mirror of
https://github.com/rocky-linux/os-autoinst-distri-rocky.git
synced 2024-11-22 13:11:26 +00:00
add base_service_manipulation test
Summary: Not much to say, pretty much just implements the test case using some commands I dug up that give us handy 0/1 exit statuses. The assert_script_run function (from testapi) simply runs a command/script and passes or fails based on the exit status; we use a handy bash-ism when we *want* the exit status to be 1. Test Plan: Run the test and check that it passes (properly). Reviewers: jskladan, garretraziel Reviewed By: garretraziel Subscribers: tflink Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D713
This commit is contained in:
parent
feac11d4d2
commit
63e03ecbdf
42
templates
42
templates
@ -215,6 +215,39 @@
|
|||||||
},
|
},
|
||||||
test_suite => { name => "base_services_start" },
|
test_suite => { name => "base_services_start" },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
machine => { name => "64bit" },
|
||||||
|
prio => 40,
|
||||||
|
product => {
|
||||||
|
arch => "x86_64",
|
||||||
|
distri => "fedora",
|
||||||
|
flavor => "generic_boot",
|
||||||
|
version => "*",
|
||||||
|
},
|
||||||
|
test_suite => { name => "base_service_manipulation" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
machine => { name => "64bit" },
|
||||||
|
prio => 40,
|
||||||
|
product => {
|
||||||
|
arch => "x86_64",
|
||||||
|
distri => "fedora",
|
||||||
|
flavor => "workstation_live",
|
||||||
|
version => "*",
|
||||||
|
},
|
||||||
|
test_suite => { name => "base_service_manipulation" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
machine => { name => "64bit" },
|
||||||
|
prio => 40,
|
||||||
|
product => {
|
||||||
|
arch => "x86_64",
|
||||||
|
distri => "fedora",
|
||||||
|
flavor => "server_dvd",
|
||||||
|
version => "*",
|
||||||
|
},
|
||||||
|
test_suite => { name => "base_service_manipulation" },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
machine => { name => "64bit" },
|
machine => { name => "64bit" },
|
||||||
prio => 30,
|
prio => 30,
|
||||||
@ -1287,5 +1320,14 @@
|
|||||||
{ key => "HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" },
|
{ key => "HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name => "base_service_manipulation",
|
||||||
|
settings => [
|
||||||
|
{ key => "ENTRYPOINT", value => "base_service_manipulation" },
|
||||||
|
{ key => "START_AFTER_TEST", value => "default_install" },
|
||||||
|
{ key => "BOOTFROM", value => "c" },
|
||||||
|
{ key => "HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" },
|
||||||
|
],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
61
tests/base_service_manipulation.pm
Normal file
61
tests/base_service_manipulation.pm
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
use base "installedtest";
|
||||||
|
use strict;
|
||||||
|
use testapi;
|
||||||
|
|
||||||
|
sub run {
|
||||||
|
my $self=shift;
|
||||||
|
# wait for boot to complete
|
||||||
|
$self->boot_to_login_screen("", 30);
|
||||||
|
# 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";
|
||||||
|
$self->boot_to_login_screen("", 30);
|
||||||
|
$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";
|
||||||
|
$self->boot_to_login_screen("", 30);
|
||||||
|
$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";
|
||||||
|
$self->boot_to_login_screen("", 30);
|
||||||
|
$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:
|
Loading…
Reference in New Issue
Block a user