]> git.sur5r.net Git - bacula/bacula/commitdiff
regress: Add test for comment field
authorEric Bollengier <eric@eb.homelinux.org>
Tue, 26 Jan 2010 10:04:48 +0000 (11:04 +0100)
committerEric Bollengier <eric@eb.homelinux.org>
Mon, 2 Aug 2010 14:49:23 +0000 (16:49 +0200)
regress/tests/comment-test [new file with mode: 0755]

diff --git a/regress/tests/comment-test b/regress/tests/comment-test
new file mode 100755 (executable)
index 0000000..9f266a3
--- /dev/null
@@ -0,0 +1,102 @@
+#!/bin/sh
+#
+# Run a simple backup of the Bacula build directory then create some           
+#   new files, do an Incremental and restore those two files.
+#
+TestName="incremental-test"
+JobName=Incremental 
+. scripts/functions
+
+${rscripts}/cleanup
+${rscripts}/copy-test-confs
+echo "${tmpsrc}" >${tmp}/file-list
+mkdir -p ${tmpsrc}
+cp -p ${src}/src/dird/*.c ${tmpsrc}
+cd ${tmp}
+echo "${tmpsrc}/ficheriro1.txt" >restore-list
+echo "${tmpsrc}/ficheriro2.txt" >>restore-list
+cd ${cwd}
+
+change_jobname CompressedTest $JobName
+start_test
+
+cat <<END_OF_DATA >${tmp}/bconcmds
+@$out /dev/null
+messages
+@$out ${tmp}/log1.out
+run comment="This is a comment for $JobName" job=$JobName yes
+status client
+@sleep 5
+status dir
+label storage=File volume=TestVolume001
+mount storage=File
+wait
+messages
+@$out $tmp/log3.out
+sql
+SELECT Comment FROM Job WHERE JobId=1;
+
+quit
+END_OF_DATA
+
+run_bacula
+check_for_zombie_jobs storage=File
+#
+# Now create two new files to be restored later
+#
+sleep 1
+echo "ficheriro1.txt" >${tmpsrc}/ficheriro1.txt
+cp -f ${tmpsrc}/dird.c ${tmpsrc}/ficheriro2.txt
+
+cat <<END_OF_DATA >${tmp}/bconcmds
+@$out /dev/null
+messages
+@$out ${tmp}/log1.out
+@# Force Incremental on the second Volume
+update volume=TestVolume001 VolStatus=Used
+run comment="This is the incremental job" level=Differential job=$JobName yes
+@sleep 5
+status dir
+label storage=File volume=TestVolume002
+mount storage=File
+wait
+messages
+@$out $tmp/log3.out
+sql
+SELECT Comment FROM Job WHERE JobId=2;
+
+quit
+END_OF_DATA
+
+run_bconsole
+
+cat <<END_OF_DATA >${tmp}/bconcmds
+@$out /dev/null
+messages
+@$out ${tmp}/log2.out
+@# 
+@# now do a restore
+@#
+restore comment="Ticket #1220 requested by toto@bacula.org" where=${tmp}/bacula-restores storage=File file=<${tmp}/restore-list
+yes
+status dir
+wait
+messages
+@$out $tmp/log3.out
+sql
+SELECT Comment FROM Job WHERE JobId=3;
+
+quit
+END_OF_DATA
+
+run_bconsole
+check_for_zombie_jobs storage=File
+stop_bacula
+
+check_two_logs
+#
+# Delete .c files because we will only restored the txt files
+#
+rm -f ${tmpsrc}/*.c
+check_restore_tmp_build_diff
+end_test