From 09d4e5aeff6838f3b3587f1547bab37f43795ff1 Mon Sep 17 00:00:00 2001 From: Steve Barnes Date: May 31 2011 12:37:30 +0000 Subject: Added p_webalizer test from Athmane Madjoudj. Added some instructions to WritingTests that should hopefully start to make test script writing easy for anyone to start working on. --- diff --git a/WritingTests b/WritingTests index bd1c705..bcac256 100644 --- a/WritingTests +++ b/WritingTests @@ -7,6 +7,10 @@ This file provides guidance on things to bear in mind when writing test scripts (c) all test scripts should first make a call to t_Log, passing in $0 and a description of what the test is doing, something like: - t_Log Running $0 - Postfix SMTP test. + t_Log "Running $0 - Postfix SMTP test." (d) test scripts are processed in alphabetical order, so it's best to install any required packages in a 0-install-blah.sh script. Anything starting with a _ is ignored, and so are files named `readme` (case insensitive) + +(e) all test scripts must be chmod +x in order to be executed. Equally, removing execute permissions from a script will prevent it from being run (or prefixing it with an _, both approaches work) + + diff --git a/tests/p_webalizer/0-install_webalizer.sh b/tests/p_webalizer/0-install_webalizer.sh new file mode 100755 index 0000000..5709445 --- /dev/null +++ b/tests/p_webalizer/0-install_webalizer.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +t_InstallPackage webalizer +t_ServiceControl httpd reload diff --git a/tests/p_webalizer/webalizer_test.sh b/tests/p_webalizer/webalizer_test.sh new file mode 100755 index 0000000..e367e6d --- /dev/null +++ b/tests/p_webalizer/webalizer_test.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - Webalizer test." + +# Run some requests +for i in `seq 10` +do + curl http://localhost/ > /dev/null 2>&1 +done + +# Trigger webalizer cron manualy +/etc/cron.daily/00webalizer + +# Run the test +echo -e "GET /usage/ HTTP/1.0\r\n" | nc localhost 80 | grep 'Usage Statistics for' > /dev/null 2>&1 + +t_CheckExitStatus $?