]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/win32-mssql-test
Simplify restart regress because of one-shot hangup
[bacula/bacula] / regress / tests / win32-mssql-test
1 #!/bin/sh
2 #
3 # How to use this test
4 # --------------------
5 #
6 # * Get a working Windows OS on your network
7 # * Install strawberry perl version with msi to c:/strawberry
8 #   http://www.bacula.org/downloads/depkgs-mingw32/strawberry-perl-5.10.1.0.msi
9 # * Install the latest version of Bacula FD
10 # * Copy or make accessible (Network share, VirtualBox share) 
11 #     regress/scripts/regress-win32.pl
12 # * Execute the script on the Windows box
13 #     perl regress-win32.pl
14 # * Run this script with the proper config settings about WIN32
15 #   see win32-fd-test
16 #
17 # * Install MSSQL with default options, put database username in config
18 #  WIN32_MSSQL_USER=sa
19 #  WIN32_MSSQL_PASS=password
20 #
21 # Note, once everything is setup, and you have run the above once
22 #  you can simply run the first part of this script prior to the URL=
23 #  to get the proper conf files loaded in bin, then manually
24 #  start bacula, and run the "MSSQLJob" backup job, then
25 #  restore it.
26 #
27 TestName="win32-mssql-test"
28 . scripts/functions
29
30 scripts/cleanup
31 scripts/copy-test-confs
32 cp scripts/win32-bacula-dir-systemstate.conf bin/bacula-dir.conf
33
34 echo "Connect with Win32 server"
35 URL=http://$WIN32_ADDR:8091
36 wget -qO $tmp/stop.log "$URL/stop"
37 wget -qO $tmp/update.log "$URL/set_director_name?name=$HOST-dir;pass=$WIN32_PASSWORD"
38 wget -qO $tmp/start.log "$URL/start"
39 set -e
40 wget -qO - "$URL/check_mssql?user=$WIN32_MSSQL_USER;pass=$WIN32_MSSQL_PASS" | grep OK
41 wget -qO - "$URL/setup_mssql_db?db=db$$" | grep OK
42 set +e
43
44 echo "Start test"
45 start_test
46       
47 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
48 @output
49 messages
50 @$out ${cwd}/tmp/log1.out
51 status client=$WIN32_CLIENT
52 label storage=File volume=TestVolume001
53 run job=MSSQLJob storage=File yes
54 wait
55 messages
56 quit
57 END_OF_DATA
58
59 run_bacula
60
61 wget -qO - "$URL/cleanup_mssql_db?db=db$$" | grep OK > /dev/null
62 if [ $? -ne 0 ]; then
63     print_debug "ERROR: can't remove mssql db$$"
64     estat=1
65 fi
66
67 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
68 @# 
69 @# now do a restore
70 @#
71 @$out ${cwd}/tmp/log2.out
72 restore where=/ storage=File
73 5
74 cd @MSSQL/
75 cd SqlServerWriter/
76 cd WIN2003/
77 m db$$
78 done
79 yes
80 wait
81 messages
82 quit
83 END_OF_DATA
84
85 run_bconsole
86
87 check_for_zombie_jobs storage=File
88 stop_bacula
89
90 check_two_logs
91
92 wget -qO - "$URL/online_mssql_db?mdf=db$$;db=restoredb$$" | grep OK > /dev/null
93 if [ $? -ne 0 ]; then
94     print_debug "ERROR: can't put db$$ online"
95     estat=1
96 fi
97
98 wget -qO - "$URL/test_mssql_content?db=restoredb$$" | grep OK > /dev/null
99 if [ $? -ne 0 ]; then
100     print_debug "ERROR: can't get content of restoredb$$"
101     estat=1
102 fi
103
104 wget -qO $tmp/cleanup.log "$URL/cleanup_mssql_db?db=restoredb$$"
105
106 end_test