]> git.sur5r.net Git - bacula/bacula/commitdiff
ebl Add small tests for statistics
authorEric Bollengier <eric@eb.homelinux.org>
Tue, 16 Sep 2008 20:49:40 +0000 (20:49 +0000)
committerEric Bollengier <eric@eb.homelinux.org>
Tue, 16 Sep 2008 20:49:40 +0000 (20:49 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7604 91ce42f0-d328-0410-95d8-f526ca767f89

regress/DartTestfile.txt.in
regress/all-disk-tests
regress/tests/stats-test

index feb6afa2edf6f9651a9c63f40077bb81d9584b7a..dbb55370eae0af497d1ef89f90d1f7b75a3086d1 100644 (file)
@@ -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")
index 9355fd676e4f9cad8caf423ba0bdd69596ae9e2f..0ddfaf58b8c4ef34d1607b9dee5abf32514827b0 100755 (executable)
@@ -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
index 6c3dc0d660ab6c650b6b3b04afb18803e3f00f7f..b85be60a952c6eb492b729feb0873bc14f182cf5 100755 (executable)
@@ -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