]> git.sur5r.net Git - bacula/bacula/blobdiff - regress/tests/stats-test
Make out of freespace non-fatal for removable devices -- i.e. behaves like tape
[bacula/bacula] / regress / tests / stats-test
index 6c3dc0d660ab6c650b6b3b04afb18803e3f00f7f..00771dd0c62e0e10a4f6095934f9fd3d72c98e99 100755 (executable)
@@ -1,4 +1,9 @@
 #!/bin/sh
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+
 #
 # Do some tests with statistics commands
 #
@@ -14,45 +19,70 @@ 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
 
-change_jobname Client1 $JobName
+change_jobname BackupClient1 $JobName
 start_test
 
 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
 @output /dev/null
 messages
 @$out ${cwd}/tmp/log1.out
-label volume=TestVolume001 storage=File pool=Default
+label volume=TestVolume001 storage=File1 pool=File slot=1 drive=0
 run job=$JobName yes
 wait
 messages
 update stats days=1
-@$out ${cwd}/tmp/log2.out
 sql
-SELECT * FROM JobStat;
+SELECT 'FOUND' AS test FROM JobHisto;
 
 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 JobHisto;
 
 list jobs
+prune stats yes
+@$out ${cwd}/tmp/log3.out
+sql
+SELECT 'FOUND' AS test FROM JobHisto;
+
 quit
 END_OF_DATA
 
 run_bacula
-export dstat=0
-export rstat=0
-export bstat=0
-check_for_zombie_jobs storage=File
+
+dstat=0
+rstat=0
+bstat=0
+
+check_for_zombie_jobs storage=File1
 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 JobHisto table"
+    bstat=1
+fi
+
+COUNT=`grep FOUND ${cwd}/tmp/log2.out | wc -l`
+if [ $COUNT -ne 3 ]; then
+    print_debug "Bad count in JobHisto table"
+    bstat=2
+fi
+
+COUNT=`grep FOUND ${cwd}/tmp/log3.out | wc -l`
+if [ $COUNT -ne 1 ]; then
+    print_debug "Bad count in JobHisto table"
+    bstat=3
+fi
 
 end_test