]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/broken-media-bug-test
Add Graham's second test
[bacula/bacula] / regress / tests / broken-media-bug-test
1 #!/bin/sh
2 #
3 # Show the broken media bug. Test by Graham Keeling.
4 #
5 # For the moment this test will always fail, so do not add
6 #   it to the standard test set.
7 # The problem:
8 # - You begin writing a giant job onto a Volume
9 # - There are no other volumes available for writing (big mistake).
10 # - You start a second job that needs a Volume to write on.
11 # - The second job see that there are no JobMedia records associated with the 
12 #    Volume (not yet written), so it purges the Volume.
13 # - A sort of chaos then follows.
14 #
15
16 TestName="broken-media-bug-test"
17 . scripts/functions
18
19 cwd=`pwd`
20 scripts/cleanup
21 /bin/cp -f scripts/broken-media-bug-bacula-dir.conf bin/bacula-dir.conf
22 /bin/cp -f scripts/test-bacula-sd.conf bin/bacula-sd.conf
23 /bin/cp -f scripts/test-bacula-fd.conf bin/bacula-fd.conf
24 /bin/cp -f scripts/test-console.conf bin/bconsole.conf
25 hugefile=${cwd}/build/hugefile
26 hugefilesize=300
27 echo "${cwd}/build" >${cwd}/tmp/file-list
28
29 start_test
30
31 echo "Creating huge ${hugefilesize}M file..."
32 dd if=/dev/urandom of="$hugefile" bs=1M count="$hugefilesize"
33 echo "Done"
34
35 cat >tmp/bconcmds <<END_OF_DATA
36 @out /dev/null
37 messages
38 @$out tmp/log1.out
39 setdebug level=150  storage=File
40 setdebug level=150  Director
41 label storage=File volume=TestVolume0001
42 label storage=File volume=TestVolume0002
43 run job=First yes
44 messages
45 quit
46 END_OF_DATA
47
48 run_bacula
49
50 # Give the first job a bit of time to get going.
51 sleep 5
52
53 cat >tmp/bconcmds <<END_OF_DATA
54 setdebug level=150  storage=File
55 setdebug level=150  Director
56 list volumes
57 llist volume=TestVolume0001
58 llist volume=TestVolume0002
59 messages
60 @$out tmp/log2.out
61 run job=Second yes
62 wait
63 messages
64 restore fileset=Set1 where=${cwd}/tmp/bacula-restores select all storage=File done
65 yes
66 wait
67 messages
68 quit
69 END_OF_DATA
70
71 run_bconsole
72 check_for_zombie_jobs storage=File
73 stop_bacula
74
75 check_two_logs
76 check_restore_diff
77 rm -f "$hugefile"
78 end_test