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