]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/stats-test
Tweak more debug for FreeBSD to verify-data-test
[bacula/bacula] / regress / tests / stats-test
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6
7 #
8 # Do some tests with statistics commands
9 #
10 TestName="stats-test"
11 JobName=backup
12 . scripts/functions
13
14 scripts/cleanup
15 scripts/copy-confs
16
17 #
18 # Zap out any schedule in default conf file so that
19 #  it doesn't start during our test
20 #
21 outf="tmp/sed_tmp"
22 echo "s%  Schedule =%# Schedule =%g" > $outf
23 echo "s% DIRport%Statistics Retention = 1 sec; DIRport%g" >> $outf
24 cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1
25 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf
26
27 change_jobname BackupClient1 $JobName
28 start_test
29
30 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
31 @output /dev/null
32 messages
33 @$out ${cwd}/tmp/log1.out
34 label volume=TestVolume001 storage=File1 pool=File slot=1 drive=0
35 run job=$JobName yes
36 wait
37 messages
38 update stats days=1
39 sql
40 SELECT 'FOUND' AS test FROM JobHisto;
41
42 run job=$JobName yes
43 wait
44 messages
45 @sleep 5
46 @$out ${cwd}/tmp/log2.out
47 update stats
48 sql
49 SELECT 'FOUND' AS test FROM JobHisto;
50
51 list jobs
52 prune stats yes
53 @$out ${cwd}/tmp/log3.out
54 sql
55 SELECT 'FOUND' AS test FROM JobHisto;
56
57 quit
58 END_OF_DATA
59
60 run_bacula
61
62 dstat=0
63 rstat=0
64 bstat=0
65
66 check_for_zombie_jobs storage=File1
67 stop_bacula
68
69
70 COUNT=`grep FOUND ${cwd}/tmp/log1.out | wc -l`
71 if [ $COUNT -ne 1 ]; then
72     print_debug "Bad count in JobHisto table"
73     bstat=1
74 fi
75
76 COUNT=`grep FOUND ${cwd}/tmp/log2.out | wc -l`
77 if [ $COUNT -ne 3 ]; then
78     print_debug "Bad count in JobHisto table"
79     bstat=2
80 fi
81
82 COUNT=`grep FOUND ${cwd}/tmp/log3.out | wc -l`
83 if [ $COUNT -ne 1 ]; then
84     print_debug "Bad count in JobHisto table"
85     bstat=3
86 fi
87
88 end_test