From 4f8977418820276fd79693688df997b9463544b9 Mon Sep 17 00:00:00 2001 From: Athmane Madjoudj Date: Sep 10 2011 12:41:27 +0000 Subject: Add cron and logrotate tests --- diff --git a/tests/p_cron/0-install_cron.sh b/tests/p_cron/0-install_cron.sh new file mode 100755 index 0000000..d66447d --- /dev/null +++ b/tests/p_cron/0-install_cron.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +t_Log "$0 - Installing crond" +if (t_GetPkgRel basesystem | grep -q el6) +then + t_InstallPackage cronie + service crond start +else + t_InstallPackage vixie-cron + service crond start +fi + diff --git a/tests/p_cron/cron_crontab_daily_test.sh b/tests/p_cron/cron_crontab_daily_test.sh new file mode 100755 index 0000000..e75ebc0 --- /dev/null +++ b/tests/p_cron/cron_crontab_daily_test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - crontab test." + +run-parts /etc/cron.daily +tail /var/log/cron | grep -q 'run-parts(/etc/cron.daily)' + + +t_CheckExitStatus $? diff --git a/tests/p_cron/cron_crontab_hourly_test.sh b/tests/p_cron/cron_crontab_hourly_test.sh new file mode 100755 index 0000000..9a3879d --- /dev/null +++ b/tests/p_cron/cron_crontab_hourly_test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - crontab test." + +run-parts /etc/cron.hourly +tail /var/log/cron | grep -q 'run-parts(/etc/cron.hourly)' + + +t_CheckExitStatus $? diff --git a/tests/p_cron/cron_crontab_weekly_test.sh b/tests/p_cron/cron_crontab_weekly_test.sh new file mode 100755 index 0000000..cea1665 --- /dev/null +++ b/tests/p_cron/cron_crontab_weekly_test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - crontab test." + +run-parts /etc/cron.weekly +tail /var/log/cron | grep -q 'run-parts(/etc/cron.weekly)' + + +t_CheckExitStatus $? diff --git a/tests/p_logrotate/0-install_logrotate.sh b/tests/p_logrotate/0-install_logrotate.sh new file mode 100755 index 0000000..035764c --- /dev/null +++ b/tests/p_logrotate/0-install_logrotate.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +t_Log "$0 - Installing logrotate" +t_InstallPackage logrotate + diff --git a/tests/p_logrotate/logrotate_test.sh b/tests/p_logrotate/logrotate_test.sh new file mode 100755 index 0000000..774f827 --- /dev/null +++ b/tests/p_logrotate/logrotate_test.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - logrotate test." + +/usr/sbin/logrotate -f /etc/logrotate.conf + +t_CheckExitStatus $?