Add tests for QA:Testcase Remote Logging test case

This commit adds server and client tests to cover the remote
logging Server test case.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2019-03-28 11:18:01 -07:00
parent 9a2d9ea190
commit b1a0fd7dc3
3 changed files with 136 additions and 0 deletions

View File

@ -831,6 +831,28 @@
},
test_suite => { name => "server_database_client" },
},
{
machine => { name => "64bit" },
prio => 20,
product => {
arch => "x86_64",
distri => "fedora",
flavor => "Server-dvd-iso",
version => "*",
},
test_suite => { name => "server_remote_logging_server" },
},
{
machine => { name => "64bit" },
prio => 20,
product => {
arch => "x86_64",
distri => "fedora",
flavor => "Server-dvd-iso",
version => "*",
},
test_suite => { name => "server_remote_logging_client" },
},
{
machine => { name => "64bit" },
prio => 40,
@ -5624,6 +5646,38 @@
{ key => "WORKER_CLASS", value => "tap" },
],
},
{
name => "server_remote_logging_server",
settings => [
{ key => "PARALLEL_CANCEL_WHOLE_CLUSTER", value => "0" },
{ key => "POSTINSTALL", value => "server_remote_logging_server" },
{ key => "USER_LOGIN", value => "false" },
{ key => "ROOT_PASSWORD", value => "weakpassword" },
{ key => "START_AFTER_TEST", value => "install_default_upload" },
{ key => "BOOTFROM", value => "c" },
{ key => "HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" },
{ key => "GRUB_POSTINSTALL", value => "net.ifnames=0 biosdevname=0" },
{ key => "POST_STATIC", value => "10.0.2.112 rsyslogserver.domain.local" },
{ key => "NICTYPE", value => "tap" },
{ key => "WORKER_CLASS", value => "tap" },
],
},
{
name => "server_remote_logging_client",
settings => [
{ key => "POSTINSTALL", value => "server_remote_logging_client" },
{ key => "USER_LOGIN", value => "false" },
{ key => "ROOT_PASSWORD", value => "weakpassword" },
{ key => "START_AFTER_TEST", value => "install_default_upload" },
{ key => "PARALLEL_WITH", value => "server_remote_logging_server" },
{ key => "BOOTFROM", value => "c" },
{ key => "HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" },
{ key => "GRUB_POSTINSTALL", value => "net.ifnames=0 biosdevname=0" },
{ key => "POST_STATIC", value => "10.0.2.113 rsyslogclient.domain.local" },
{ key => "NICTYPE", value => "tap" },
{ key => "WORKER_CLASS", value => "tap" },
],
},
{
name => "desktop_update_graphical",
settings => [

View File

@ -0,0 +1,39 @@
use base "installedtest";
use strict;
use testapi;
use lockapi;
sub run {
my $self=shift;
if (not (check_screen "root_console", 0)) {
$self->root_console(tty=>3);
}
# ensure rsyslog is installed and enabled
script_run "dnf -y install rsyslog", 180;
script_run "systemctl enable --now rsyslog.service";
# set up forwarding
assert_script_run "printf 'action(type=\"omfwd\"\nTarget=\"10.0.2.112\" Port=\"514\" Protocol=\"udp\")' >> /etc/rsyslog.conf";
# for debugging
upload_logs "/etc/rsyslog.conf";
# wait for server to be ready, then restart rsyslog
mutex_lock "rsyslog_server_ready";
mutex_unlock "rsyslog_server_ready";
assert_script_run "systemctl restart rsyslog.service";
# send a test message and tell server we did it
assert_script_run "logger user.warn XXX RSYSLOG TEST MESSAGE";
sleep 2;
# for debugging
upload_logs "/var/log/messages";
mutex_create "rsyslog_message_sent";
# wait for server to tell us it got the message
mutex_lock "rsyslog_message_received";
mutex_unlock "rsyslog_message_received";
}
sub test_flags {
return { fatal => 1 };
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,43 @@
use base "installedtest";
use strict;
use testapi;
use lockapi;
use mmapi;
sub run {
my $self=shift;
if (not (check_screen "root_console", 0)) {
$self->root_console(tty=>3);
}
# ensure rsyslog is installed and enabled
script_run "dnf -y install rsyslog", 180;
script_run "systemctl enable --now rsyslog.service";
# set up imudp module
assert_script_run 'sed -i -e "s,#module(load=\"imudp\"),module(load=\"imudp\"),g" /etc/rsyslog.conf';
assert_script_run 'sed -i -e "s,#input(type=\"imudp\",input(type=\"imudp\",g" /etc/rsyslog.conf';
# for debugging
upload_logs "/etc/rsyslog.conf";
# open firewall port
assert_script_run 'firewall-cmd --permanent --add-port=514/udp';
assert_script_run 'firewall-cmd --reload';
# start rsyslog
assert_script_run "systemctl restart rsyslog.service";
# tell client we're ready and wait for it to send the message
mutex_create("rsyslog_server_ready");
my $children = get_children();
my $child_id = (keys %$children)[0];
mutex_lock('rsyslog_message_sent', $child_id);
mutex_unlock('rsyslog_message_sent');
# check we got the message
assert_script_run 'grep "XXX RSYSLOG TEST MESSAGE" /var/log/messages';
# tell child test we were successful
mutex_create("rsyslog_message_received");
}
sub test_flags {
return { fatal => 1 };
}
1;
# vim: set sw=4 et: