From 8c0afd5556cbd374a471b98cf7d6953557b7a535 Mon Sep 17 00:00:00 2001 From: Rene Diepstraten Date: Dec 30 2013 09:31:37 +0000 Subject: Created new tests for systemd --- diff --git a/tests/p_systemd/10-systemctl_list_services.sh b/tests/p_systemd/10-systemctl_list_services.sh new file mode 100755 index 0000000..1e2b3d5 --- /dev/null +++ b/tests/p_systemd/10-systemctl_list_services.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# Author: Athmane Madjoudj +# Rene Diepstraten + +t_Log "Running $0 - Checking if systemctl can check if a service is enabled" +[ ${centos_ver} -lt 7 ] && { t_Log "Systemd is part of el since el7, skipping systemd tests..." ; exit ; } + +# auditd is used as example because it's standard with minimal install + +systemctl is-enabled auditd.service > /dev/null + +t_CheckExitStatus $? \ No newline at end of file diff --git a/tests/p_systemd/15-systemctl_list_non-native-services.sh b/tests/p_systemd/15-systemctl_list_non-native-services.sh new file mode 100755 index 0000000..c9f757d --- /dev/null +++ b/tests/p_systemd/15-systemctl_list_non-native-services.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# Author: Athmane Madjoudj +# Rene Diepstraten + +[ ${centos_ver} -lt 7 ] && exit +t_Log "Running $0 - Checking if systemctl can check if a non-native service is enabled" + +# netconsole is used as example because it's a non native service with minimal install + +systemctl is-enabled netconsole.service 2> /dev/null | grep -q -E 'enabled|disabled' + +t_CheckExitStatus $? diff --git a/tests/p_systemd/20-systemctl_list-service-status.sh b/tests/p_systemd/20-systemctl_list-service-status.sh new file mode 100755 index 0000000..ecd2bee --- /dev/null +++ b/tests/p_systemd/20-systemctl_list-service-status.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Author: Rene Diepstraten + +[ ${centos_ver} -lt 7 ] && exit +t_Log "Running $0 - checking if systemctl can check a service status" + +systemctl is-active auditd.service > /dev/null + +t_CheckExitStatus $? \ No newline at end of file diff --git a/tests/p_systemd/25-journalctl.sh b/tests/p_systemd/25-journalctl.sh new file mode 100755 index 0000000..e43631b --- /dev/null +++ b/tests/p_systemd/25-journalctl.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# Author: Rene Diepstraten + +[ ${centos_ver} -lt 7 ] && exit +t_Log "Running $0 - Testing journalctl for teststring" + +teststring=098f6bcd4621d373cade4e832627b4f6 +timenow=$(date +'%T') +echo ${teststring} > /dev/kmsg +journalctl --since ${timenow} | grep -q ${teststring} + +t_CheckExitStatus $? \ No newline at end of file