From: Kern Sibbald Date: Wed, 2 Sep 2020 13:03:40 +0000 (+0200) Subject: BEE Backport regress/tests/cloud-test X-Git-Tag: Release-11.3.2~1250 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e3ce1c762cf91a9cf758cf6a6083424a596f6aaa;p=thirdparty%2Fbacula.git BEE Backport regress/tests/cloud-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 Jan 11 10:03:12 2019 +0100 regress: Check if the "cloud list" function returns the volume list Author: Eric Bollengier Date: Fri Nov 16 16:36:40 2018 +0100 regress: Fix cloud-test check_restore_diff with FORCE_FILE_SET Author: Norbert Bizet Date: Fri Nov 16 15:33:09 2018 +0100 regress: Add multi cloud test Author: Eric Bollengier Date: Thu Feb 2 10:20:35 2017 +0100 regress: Add specific cloud test for the recycling Author: Eric Bollengier Date: Wed Jan 18 15:01:56 2017 +0100 regress: Modify cloud-test to expose a bug with the cache Author: Eric Bollengier Date: Thu Nov 24 09:36:41 2016 +0100 Get error message from get_cloud_volume... procedures Author: Kern Sibbald Date: Fri Nov 18 09:36:30 2016 +0100 Tweak fix minor problems in cloud-test Author: Eric Bollengier Date: Wed Nov 16 15:54:33 2016 +0100 regress: Add truncate command to cloud-test Author: Kern Sibbald Date: Fri Nov 11 15:04:16 2016 +0100 regress: tweak elimate small error message Author: Kern Sibbald Date: Fri Nov 11 14:23:59 2016 +0100 Tweak cloud-test to be partial Author: Kern Sibbald Date: Fri Nov 4 18:26:10 2016 +0100 Tweak cloud-test to destroy cache between backup jobs Author: Kern Sibbald Date: Thu Nov 3 17:44:10 2016 +0100 Fix core code to restore with only necessary parts in cache Author: Kern Sibbald Date: Tue Nov 1 12:19:04 2016 +0100 Tweak cloud-test Author: Kern Sibbald Date: Tue Nov 1 12:15:05 2016 +0100 Add simple cloud-test -- to be improved --- diff --git a/regress/tests/cloud-test b/regress/tests/cloud-test new file mode 100755 index 0000000000..e4cd5eee47 --- /dev/null +++ b/regress/tests/cloud-test @@ -0,0 +1,115 @@ +#!/bin/sh +# +# Copyright (C) 2000-2020 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# Cloud test. We run backups and restore with the "truncate cache" command in-between +# +TestName="cloud-test" +JobName=NightlySave +. scripts/functions + +require_cloud + +#config is required for cloud cleanup +scripts/copy-test-confs +scripts/cleanup + +FORCE_FILE_SET=${FORCE_FILE_SET:-"${cwd}/build"} +echo "$FORCE_FILE_SET" >${cwd}/tmp/file-list + +start_test + +$bperl -e 'add_attribute("$conf/bacula-sd.conf", "MaximumPartSize", "10000000", "Device")' +$bperl -e 'add_attribute("$conf/bacula-sd.conf", "MaximumUploadBandwidth", "4MB/s", "Cloud")' +$bperl -e 'add_attribute("$conf/bacula-sd.conf", "MaximumDownloadBandwidth", "4MB/s", "Cloud")' + + +cat <${cwd}/tmp/bconcmds +@output /dev/null +messages +@$out ${cwd}/tmp/log1.out +label storage=File volume=Vol1 +END_OF_DATA + +# do label +run_bacula + +cat <${cwd}/tmp/bconcmds +@output /dev/null +messages +@$out ${cwd}/tmp/log1.out +@#setdebug level=500 storage +run job=$JobName level=Full yes +wait +list volumes +llist volume=Vol1 +messages +truncate cache volume=Vol1 storage=File +END_OF_DATA + +for i in 1 2 ; do + echo "Running job $i" + run_bconsole + ls -l tmp/Vol* +done + +cat <${cwd}/tmp/bconcmds-form +@# +@# now do a restore +@# +@$out ${cwd}/tmp/log2.out +@#setdebug level=200 client +@#setdebug level=350 storage +truncate cache volume=Vol1 storage=File +@exec "ls -l ${cwd}/tmp/Vol1" +restore where=${cwd}/tmp/bacula-restores storage=File jobid=@jobid@ +mark * +done +yes +wait +messages +sql +select * from JobMedia; + +@$out $tmp/log31.out +cloud list storage=File +@$out $tmp/log3.out +cloud list volume=Vol1 storage=File +quit +END_OF_DATA + +# Restore and check each job +for i in 2; do + rm -rf ${cwd}/tmp/bacula-restores $tmp/log3*out + echo "s%@jobid@%$i%" >${cwd}/tmp/in + sed -f ${cwd}/tmp/in ${cwd}/tmp/bconcmds-form >${cwd}/tmp/bconcmds + run_bconsole + nb=`cat $tmp/log3.out | wc -l` + if [ "$nb" -lt 10 ]; then + print_debug "ERROR: Not enough lines in $tmp/log3.out for the parts list" + estat=1 + fi + grep Vol1 $tmp/log31.out > /dev/null + if [ $? -ne 0 ]; then + print_debug "ERROR: Unable to find the volume list in $tmp/log31.out" + estat=1 + fi +done + +ls -l tmp/Vol* >>${cwd}/tmp/log5.out +ls -l ${cwd}/tmp/Vol1 + +sleep 2 +check_for_zombie_jobs storage=File +stop_bacula + +check_two_logs +#check_restore_diff + +$rscripts/diff.pl -s "$FORCE_FILE_SET" -d "$cwd/tmp/bacula-restores/$FORCE_FILE_SET" +if test $? -ne 0; then + dstat=$? +fi + +end_test