From 0a7f0fdae5c15d292f11366fa5a91a8c88f805c7 Mon Sep 17 00:00:00 2001 From: Christoph Galuschka Date: Apr 22 2012 10:40:28 +0000 Subject: added test for amanda --- diff --git a/tests/p_amanda/0-install_amanda.sh b/tests/p_amanda/0-install_amanda.sh new file mode 100755 index 0000000..409ade2 --- /dev/null +++ b/tests/p_amanda/0-install_amanda.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Athmane Madjoudj +# Christoph Galuschka + +t_Log "$0 - installing amanda system" +t_InstallPackage amanda amanda-server amanda-client diff --git a/tests/p_amanda/amanda-server_test.sh b/tests/p_amanda/amanda-server_test.sh new file mode 100755 index 0000000..83a604a --- /dev/null +++ b/tests/p_amanda/amanda-server_test.sh @@ -0,0 +1,90 @@ +#!/bin/sh +# Author: Christoph Galuschka +t_Log "Running $0 - amanda server runs a simple task (backing up /etc)" + +ret_val=0 + +# Creating necessary directories +mkdir -p /etc/amanda/MyConfig +mkdir -p /amanda/vtapes/slot{1,2} +mkdir -p /amanda/holding +mkdir -p /amanda/state/{curinfo,log,index} + +# creating testfile in /etc +# just some content to grep later +STRING='This string must be found' +echo $STRING > /etc/amandabackup-test + +cat > /etc/amanda/MyConfig/amanda.conf < /etc/amanda/MyConfig/disklist +chown -R amandabackup /etc/amanda/MyConfig +chown -R amandabackup /amanda + +## running amanda configuration check +su amandabackup -c 'amcheck MyConfig' | grep -q '0 problems found' +if [ $? = 1 ] +then + t_Log "amanda Configuration check failed." + ret_val=1 +else + t_Log "amanda Configuration OK." +fi + +## running backup of /etc +su amandabackup -c 'amdump MyConfig' +if [ $? -ne 0 ] +then + t_Log "Backup job failed." + ret_val=1 +else + t_Log "Backup job successfull." +fi + +## checking data in backup +grep -q "${STRING}" /amanda/vtapes/current/00001.localhost._etc.0 +if [ $? -ne 0 ] +then + t_Log "Something is wrong with the backup - can't find content of /etc/amandabackup-test file." + ret_val=1 +else + t_Log "Backup seems OK and contains content of /etc/amandabackup-test file." +fi + +# cleaning up +/bin/rm -rf /amanda +/bin/rm -rf /etc/amanda/MyConfig +/bin/rm -rf /etc/amandabackup-test + +t_CheckExitStatus $ret_val