]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/broken-media-bug-test
Update
[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 setdebug level=150  storage=File
37 setdebug level=150  Director
38 messages
39 @$out tmp/log1.out
40 label storage=File volume=TestVolume0001
41 label storage=File volume=TestVolume0002
42 run job=First yes
43 messages
44 quit
45 END_OF_DATA
46
47 run_bacula
48
49 # Give the first job a bit of time to get going.
50 sleep 5
51
52 cat >tmp/bconcmds <<END_OF_DATA
53 setdebug level=150  storage=File
54 setdebug level=150  Director
55 list volumes
56 llist volume=TestVolume0001
57 llist volume=TestVolume0002
58 messages
59 @$out tmp/log2.out
60 run job=Second yes
61 wait
62 messages
63 restore fileset=Set1 where=${cwd}/tmp/bacula-restores select all storage=File done
64 yes
65 wait
66 messages
67 quit
68 END_OF_DATA
69
70 run_bconsole
71 check_for_zombie_jobs storage=File
72 stop_bacula
73
74 check_two_logs
75 check_restore_diff
76 rm -f "$hugefile"
77 end_test