]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
regress: Update verify tests with files listing
authorMichal Rakowski <michal.rakowski@baculasystems.com>
Wed, 21 Jul 2021 11:18:55 +0000 (13:18 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:03 +0000 (09:03 +0100)
regress/tests/verify-cat-test
regress/tests/verify-data-test
regress/tests/verify-vol-test

index 7faa032621c65bf308bd4c584885749ae8e03150..e557e79474902a25d2d529d996812c3be9ef9dae 100755 (executable)
@@ -22,11 +22,15 @@ echo "${cwd}/build" >${cwd}/tmp/file-list
 change_jobname NightlySave $JobName
 start_test
 
+# Create list of files being backed up and verified to compare afterwards
+files_listing=${cwd}/tmp/files
+find ${cwd}/build -print > ${files_listing}
+
 cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
 messages
-@$out tmp/log1.out
 @#exec "sh -c 'touch ${cwd}/build/xxx_new_file'"
+@$out tmp/log1.out
 run job=VerifyVolume level=InitCatalog yes
 wait
 messages
@@ -44,12 +48,67 @@ END_OF_DATA
 run_bacula
 
 sleep 2
-check_for_zombie_jobs storage=File 
+check_for_zombie_jobs storage=File
 stop_bacula
 
+while IFS= read -r line <&3; do
+   grep "Veryfying: ${line}" tmp/log1.out > /dev/null
+   if [ $? -ne 0 ]; then
+      estat=1
+      print_debug "Did not found ${line} file in verified files log!"
+      print_debug "see: ${cwd}/tmp/log1.out"
+   fi
+   grep "Veryfying: ${line}" tmp/original > /dev/null
+   if [ $? -ne 0 ]; then
+      estat=1
+      print_debug "Did not found ${line} file in verified files log!"
+      print_debug "see: ${cwd}/tmp/original"
+   fi
+done 3< ${files_listing}
+
+
 grep "^  Termination: *Verify OK" tmp/log1.out 2>&1 >/dev/null
 bstat=$?
 grep "^  Termination: *Verify OK" ${cwd}/tmp/original 2>&1 >/dev/null
 rstat=$?
 dstat=0
+
+# Turn off verbose file listing, rerun verify jobs and check if files are not listed as expected
+sed -i '/console =*/ s/$/, !verified/g' bin/bacula-dir.conf | grep verified
+sed -i '/director =*/ s/$/, !verified/g' bin/bacula-fd.conf | grep verified
+
+cat <<END_OF_DATA >tmp/bconcmds
+@output /dev/null
+messages
+@$out tmp/log2.out
+run job=VerifyVolume level=InitCatalog yes
+wait
+messages
+@$out tmp/log3.out
+run job=VerifyVolume level=Catalog yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bacula
+
+check_for_zombie_jobs storage=File
+stop_bacula
+
+while IFS= read -r line <&3; do
+   grep "Veryfying: ${line}" tmp/log2.out > /dev/null
+   if [ $? -eq 0 ]; then
+      estat=1
+      print_debug "Found ${line} file in verified files log, no files should be listed now!"
+      print_debug "see: ${cwd}/tmp/log2.out"
+   grep "Veryfying: ${line}" tmp/log3.out > /dev/null
+   if [ $? -eq 0 ]; then
+      estat=1
+      print_debug "Found ${line} file in verified files log, no files should be listed now!"
+      print_debug "see: ${cwd}/tmp/log3.out"
+   fi
+   fi
+done 3< ${files_listing}
+
 end_test
index 9bc0e31398107c8e00b428afa10b13c85b6eb25b..5229493b581eda6bae7be00ea03d04a750b13071 100755 (executable)
@@ -24,6 +24,11 @@ echo "${cwd}/build/src/filed"     >>$tmp/file-list
 #mkdir -p $tmp/files
 #dd if=${cwd}/build/configure of=$tmp/files/sparsefile bs=1 count=1 seek=10M > /dev/null
 
+# Create list of files being backed up and verified to compare afterwards
+files_listing=${cwd}/tmp/files
+find ${cwd}/build/src/dird -print > ${files_listing}
+find ${cwd}/build/src/filed -print >> ${files_listing}
+
 change_jobname NightlySave $JobName
 start_test
 
@@ -76,9 +81,17 @@ END_OF_DATA
 
 run_bconsole
 
-check_for_zombie_jobs storage=File 
 stop_bacula
 
+while IFS= read -r line <&3; do
+   grep "Veryfying: ${line}" tmp/log2.out > /dev/null
+   if [ $? -ne 0 ]; then
+      estat=1
+      print_debug "Did not found ${line} file in verified files log!"
+      print_debug "see: ${cwd}/tmp/log2.out"
+   fi
+done 3< ${files_listing}
+
 $bperl -e 'add_attribute("$conf/bacula-sd.conf", "BlockChecksum", "no", "Device")'
 
 nbok=2
@@ -114,6 +127,34 @@ sleep 1
 check_for_zombie_jobs storage=File
 stop_bacula
 
+# Turn off verbose file listing, rerun verify jobs and check if files are not listed as expected
+sed -i '/console =*/ s/$/, !verified/g' bin/bacula-dir.conf | grep verified
+sed -i '/director =*/ s/$/, !verified/g' bin/bacula-fd.conf | grep verified
+
+cat <<END_OF_DATA >tmp/bconcmds
+@output /dev/null
+messages
+@$out tmp/log5.out
+run job=VerifyData jobid=1 yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bacula
+check_for_zombie_jobs storage=File
+stop_bacula
+
+
+while IFS= read -r line <&3; do
+   grep "Veryfying: ${line}" tmp/log5.out > /dev/null
+   if [ $? -eq 0 ]; then
+      estat=1
+      print_debug "Found ${line} file in verified files log, no files should be listed now!"
+      print_debug "see: ${cwd}/tmp/log5.out"
+   fi
+done 3< ${files_listing}
+
 nb=`grep "^  Termination: *Backup OK" tmp/log1.out | wc -l`
 if [ $nb -ne 6 ]; then
     bstat=1
index d1473f8570ee44851ee7d529234e7f21bdad3eef..dadb35fc7ce680d37986e8694b2be23516794c07 100755 (executable)
@@ -24,7 +24,9 @@ rm -f ${cwd}/build/sparsefile
 change_jobname NightlySave $JobName
 start_test
 
-#$bperl -e "add_attribute('$conf/bacula-dir.conf', 'VerifyJob', '$JobName', 'Job', 'VerifyVolume')"
+# Create list of files being backed up and verified to compare afterwards
+files_listing=${cwd}/tmp/files
+find ${cwd}/build -print > ${files_listing}
 
 cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
@@ -68,8 +70,29 @@ END_OF_DATA
 
 run_bacula
 
+while IFS= read -r line <&3; do
+   grep "Veryfying: ${line}" tmp/log2.out > /dev/null
+   if [ $? -ne 0 ]; then
+      estat=1
+      print_debug "Did not found ${line} file in verified files log!"
+      print_debug "see: ${cwd}/tmp/log2.out"
+   fi
+   grep "Veryfying: ${line}" tmp/log3.out > /dev/null
+   if [ $? -ne 0 ]; then
+      estat=1
+      print_debug "Did not found ${line} file in verified files log!"
+      print_debug "see: ${cwd}/tmp/log3.out"
+   fi
+   grep "Veryfying: ${line}" tmp/log4.out > /dev/null
+   if [ $? -ne 0 ]; then
+      estat=1
+      print_debug "Did not found ${line} file in verified files log!"
+      print_debug "see: ${cwd}/tmp/log4.out"
+   fi
+done 3< ${files_listing}
+
 sleep 2
-check_for_zombie_jobs storage=File 
+check_for_zombie_jobs storage=File
 stop_bacula
 
 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
@@ -86,4 +109,56 @@ if [ $? != 0 ]; then
     rstat=1
 fi
 dstat=0
+
+# Turn off verbose file listing, rerun verify jobs and check if files are not listed as expected
+sed -i '/console =*/ s/$/, !verified/g' bin/bacula-dir.conf | grep verified
+sed -i '/director =*/ s/$/, !verified/g' bin/bacula-fd.conf | grep verified
+
+cat <<END_OF_DATA >tmp/bconcmds
+@output /dev/null
+messages
+@$out ${cwd}/tmp/log5.out
+reload
+setdebug level=200 dir tags=sql trace=1
+run job=VerifyVolume yes
+wait
+messages
+@$out ${cwd}/tmp/log6.out
+run job=VerifyVolume level=DiskToCatalog jobid=1
+yes
+wait
+messages
+@$out ${cwd}/tmp/log7.out
+run job=VerifyDiskToCatalog yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bacula
+
+while IFS= read -r line <&3; do
+   grep "Veryfying: ${line}" tmp/log5.out > /dev/null
+   if [ $? -eq 0 ]; then
+      estat=1
+      print_debug "Found ${line} file in verified files log, no files should be listed now!"
+      print_debug "see: ${cwd}/tmp/log5.out"
+   fi
+   grep "Veryfying: ${line}" tmp/log6.out > /dev/null
+   if [ $? -eq 0 ]; then
+      estat=1
+      print_debug "Found ${line} file in verified files log, no files should be listed now!"
+      print_debug "see: ${cwd}/tmp/log6.out"
+   fi
+   grep "Veryfying: ${line}" tmp/log7.out > /dev/null
+   if [ $? -eq 0 ]; then
+      estat=1
+      print_debug "Found ${line} file in verified files log, no files should be listed now!"
+      print_debug "see: ${cwd}/tmp/log7.out"
+   fi
+done 3< ${files_listing}
+
+check_for_zombie_jobs storage=File
+stop_bacula
+
 end_test