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