From 6fb030e27f4e6639027c0fd28aab45f82dc2297e Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Tue, 16 Sep 2008 20:49:40 +0000 Subject: [PATCH] ebl Add small tests for statistics git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7604 91ce42f0-d328-0410-95d8-f526ca767f89 --- regress/DartTestfile.txt.in | 1 + regress/all-disk-tests | 1 + regress/tests/stats-test | 35 +++++++++++++++++++++++++++++------ 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/regress/DartTestfile.txt.in b/regress/DartTestfile.txt.in index feb6afa2ed..dbb55370ea 100644 --- a/regress/DartTestfile.txt.in +++ b/regress/DartTestfile.txt.in @@ -49,6 +49,7 @@ ADD_TEST(disk:2drive-concurrent-test "@regressdir@/tests/2drive-concurrent-test" ADD_TEST(disk:2drive-incremental-2disk "@regressdir@/tests/2drive-incremental-2disk") ADD_TEST(disk:2drive-swap-test "@regressdir@/tests/2drive-swap-test") ADD_TEST(disk:2drive-2job-test "@regressdir@/tests/2drive-2job-test") +ADD_TEST(disk:stats-test "@regressdir@/tests/stats-test") ADD_TEST(disk:three-pool-test "@regressdir@/tests/three-pool-test") ADD_TEST(disk:tls-test "@regressdir@/tests/tls-test") ADD_TEST(disk:two-jobs-test "@regressdir@/tests/two-jobs-test") diff --git a/regress/all-disk-tests b/regress/all-disk-tests index 9355fd676e..0ddfaf58b8 100755 --- a/regress/all-disk-tests +++ b/regress/all-disk-tests @@ -36,6 +36,7 @@ nice tests/restore2-by-file-test nice tests/restore-by-file-test nice tests/restore-disk-seek-test nice tests/runscript-test +nice tests/stats-test nice tests/six-vol-test nice tests/span-vol-test nice tests/maxtime-test diff --git a/regress/tests/stats-test b/regress/tests/stats-test index 6c3dc0d660..b85be60a95 100755 --- a/regress/tests/stats-test +++ b/regress/tests/stats-test @@ -14,7 +14,8 @@ scripts/copy-confs # it doesn't start during our test # outf="tmp/sed_tmp" -echo "s% Schedule =%# Schedule =%g" >${outf} +echo "s% Schedule =%# Schedule =%g" > $outf +echo "s% DIRport%Statistics Retention = 1 sec; DIRport%g" >> $outf cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf @@ -30,19 +31,24 @@ run job=$JobName yes wait messages update stats days=1 -@$out ${cwd}/tmp/log2.out sql -SELECT * FROM JobStat; +SELECT "FOUND" AS test FROM JobStat; run job=$JobName yes wait messages -@$out ${cwd}/tmp/log3.out +@sleep 5 +@$out ${cwd}/tmp/log2.out update stats sql -SELECT * FROM JobStat; +SELECT "FOUND" AS test FROM JobStat; list jobs +prune stats yes +@$out ${cwd}/tmp/log3.out +sql +SELECT "FOUND" AS test FROM JobStat; + quit END_OF_DATA @@ -53,6 +59,23 @@ export bstat=0 check_for_zombie_jobs storage=File stop_bacula -# TODO: do grep into log2 log3 to see differences + +COUNT=$(grep FOUND ${cwd}/tmp/log1.out | wc -l) +if [ $COUNT -ne 1 ]; then + print_debug "Bad count in jobstat table" + bstat=1 +fi + +COUNT=$(grep FOUND ${cwd}/tmp/log2.out | wc -l) +if [ $COUNT -ne 3 ]; then + print_debug "Bad count in jobstat table" + bstat=2 +fi + +COUNT=$(grep FOUND ${cwd}/tmp/log3.out | wc -l) +if [ $COUNT -ne 1 ]; then + print_debug "Bad count in jobstat table" + bstat=3 +fi end_test -- 2.39.5