From: Eric Bollengier Date: Wed, 2 Sep 2020 13:20:07 +0000 (+0200) Subject: BEE Backport regress/tests/cloud-concurrent-jobs-test X-Git-Tag: Release-11.3.2~1226 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=85f8aacaced3246fab86d0b2b50beeac114ac16e;p=thirdparty%2Fbacula.git BEE Backport regress/tests/cloud-concurrent-jobs-test This commit is the result of the squash of the following main commits: Author: Eric Bollengier Date: Tue Jul 21 10:28:13 2020 +0200 regress: Add copyright to regress scripts Author: Eric Bollengier Date: Fri Sep 6 18:40:05 2019 +0200 regress: Add cloud-concurrent-jobs-test --- diff --git a/regress/tests/cloud-concurrent-jobs-test b/regress/tests/cloud-concurrent-jobs-test new file mode 100755 index 0000000000..2b536a2357 --- /dev/null +++ b/regress/tests/cloud-concurrent-jobs-test @@ -0,0 +1,118 @@ +#!/bin/sh +# +# Copyright (C) 2000-2020 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# Run multiple jobs at the same time, try to recreate cloud issue +# seen in #5373 + +TestName="cloud-concurrent-jobs-test" +JobName=concurrent-jobs +. scripts/functions + +require_cloud +copy_test_confs + +echo "${cwd}/tmp/largefile" >${cwd}/tmp/file-list +echo "${cwd}/build" >>${cwd}/tmp/file-list + +if test -c /dev/urandom ; then +# Create 56MB file with random data +# echo "Creating a 56MB file with random data ..." + dd if=/dev/urandom of=${cwd}/tmp/largefile bs=1024 count=55000 2>&1 1>/dev/null +else +# echo "Creating a 56MB file with bacula-dir data ..." + dd if=$bin/bacula-dir of=${cwd}/tmp/1 bs=1024 count=1000 2>&1 1>/dev/null + cat ${cwd}/tmp/1 ${cwd}/tmp/1 ${cwd}/tmp/1 ${cwd}/tmp/1 ${cwd}/tmp/1 >${cwd}/tmp/2 + rm -f ${cwd}/tmp/1 + cat ${cwd}/tmp/2 ${cwd}/tmp/2 ${cwd}/tmp/2 ${cwd}/tmp/2 ${cwd}/tmp/2 >>${cwd}/tmp/3 + rm -f ${cwd}/tmp/2 + cat ${cwd}/tmp/3 ${cwd}/tmp/3 ${cwd}/tmp/3 ${cwd}/tmp/3 ${cwd}/tmp/3 >${cwd}/tmp/largefile + rm -f ${cwd}/tmp/3 +fi + +#echo "largefile created" + +$bperl -e "set_global_maximum_concurrent_jobs(100)" +$bperl -e "setup_fd_encryption()" +$bperl -e "add_attribute('$conf/bacula-sd.conf', 'MaximumPartSize', '256K', 'Device')" +$bperl -e "add_attribute('$conf/bacula-dir.conf', 'SpoolData', 'no', 'Job')" +$bperl -e "add_attribute('$conf/bacula-sd.conf', 'MaximumFileSize', '4MB', 'Device')" + +change_jobname CompressedTest $JobName +start_test + +cat <${cwd}/tmp/bconcmds +@output /dev/null +messages +@$out ${cwd}/tmp/log1.out +label storage=File volume=TestVolume001 +run job=$JobName level=Full yes +@sleep 4 +run job=$JobName level=Full yes +@sleep 4 +run job=$JobName level=Full yes +@sleep 4 +run job=$JobName level=Full yes +wait +restore jobid=1 where=$tmp/bacula-restores-0 storage=File all done yes +wait +messages +run job=$JobName level=Full yes +@sleep 4 +run job=$JobName level=Full yes +@sleep 4 +run job=$JobName level=Full yes +@sleep 4 +run job=$JobName level=Full yes +wait +messages +@# +@# now do a restore +@# +@$out ${cwd}/tmp/log2.out +cloud truncate storage=File volume=TestVolume001 +@exec "ls $tmp/TestVolume001/" +restore jobid=1 where=$tmp/bacula-restores-1 storage=File all done yes +restore jobid=2 where=$tmp/bacula-restores-2 storage=File all done yes +restore jobid=3 where=$tmp/bacula-restores-3 storage=File all done yes +restore jobid=4 where=$tmp/bacula-restores-4 storage=File all done yes +@# 5 was a restore +restore jobid=6 where=$tmp/bacula-restores-6 storage=File all done yes +restore jobid=7 where=$tmp/bacula-restores-7 storage=File all done yes +restore jobid=8 where=$tmp/bacula-restores-8 storage=File all done yes +restore jobid=9 where=$tmp/bacula-restores-9 storage=File all done yes +wait +messages +@output +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=File +stop_bacula + +for i in 1 2 3 4 6 7 8 9 +do + diff $tmp/bacula-restores-$i/${cwd}/tmp/largefile ${cwd}/tmp/largefile > /dev/null + if [ $? -ne 0 ]; then + print_debug "ERROR: Found difference" + estat=1 + fi + $rscripts/diff.pl -d $tmp/bacula-restores-$i/$cwd/build -s $cwd/build + if [ $? -ne 0 ]; then + print_debug "ERROR: Found difference $i" + estat=1 + fi +done + +$bin/bscan -d10,cloud -r $tmp/TestVolume001 > $tmp/bscan.log +$bperl -e "check_bscan('$tmp/bscan.log')" +if [ $? -ne 0 ]; then + print_debug "ERROR: Found issues in the bscan log" + estat=1 +fi + +check_two_logs +dstat=$? +end_test