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