]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
BEE Backport regress/tests/cloud-download-test
authorEric Bollengier <eric@baculasystems.com>
Wed, 2 Sep 2020 13:24:20 +0000 (15:24 +0200)
committerEric Bollengier <eric@baculasystems.com>
Tue, 1 Mar 2022 14:36:18 +0000 (15:36 +0100)
This commit is the result of the squash of the following main commits:

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Tue Jul 21 10:28:13 2020 +0200

    regress: Add copyright to regress scripts

Author: Norbert Bizet <norbert.bizet@baculasystems.com>
Date:   Fri Nov 16 15:33:09 2018 +0100

    regress: Add multi cloud test

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Thu Feb 2 10:37:42 2017 +0100

    regress: Add cloud test to verify that the cache is not updated by restore/bls

regress/tests/cloud-download-test [new file with mode: 0755]

diff --git a/regress/tests/cloud-download-test b/regress/tests/cloud-download-test
new file mode 100755 (executable)
index 0000000..057ef4d
--- /dev/null
@@ -0,0 +1,102 @@
+#!/bin/sh
+#
+# Copyright (C) 2000-2020 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# Cloud test. Run a backup and restore, then compare the timestamps of the
+# files in the cache directory.
+#
+TestName="cloud-download-test"
+JobName=NightlySave
+. scripts/functions
+
+require_cloud
+
+#config is required for cloud cleanup
+scripts/copy-test-confs
+scripts/cleanup
+
+if test x$FORCE_FILE_SET = x; then
+   echo "${cwd}/build" >${cwd}/tmp/file-list
+   #echo "${cwd}/build/src/Makefile" >${cwd}/tmp/file-list
+   #echo "${cwd}/build/src/Makefile.in" >>${cwd}/tmp/file-list
+   #echo "${cwd}/build/src/testprogs.tar.gz" >>${cwd}/tmp/file-list
+   #echo "${cwd}/build/src/dummy" >>${cwd}/tmp/file-list
+   #echo "${cwd}/build/src/stored" >>${cwd}/tmp/file-list
+   #echo "${cwd}/build/src/dird" >>${cwd}/tmp/file-list
+   #echo "${cwd}/build/src/filed" >>${cwd}/tmp/file-list
+   #echo "${cwd}/build/src/console" >>${cwd}/tmp/file-list
+   #echo "${cwd}/build/src/qt-console" >>${cwd}/tmp/file-list
+   #echo "${cwd}/build/src/cats" >>${cwd}/tmp/file-list
+else
+   echo "$FORCE_FILE_SET" >${cwd}/tmp/file-list
+fi
+
+start_test
+
+$bperl -e 'add_attribute("$conf/bacula-sd.conf", "MaximumPartSize", "10MB", "Device")'
+
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@output /dev/null
+messages
+@$out $tmp/log1.out
+label storage=File volume=Vol1
+END_OF_DATA
+
+# do label
+run_bacula
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@output /dev/null
+messages
+@$out $tmp/log1.out
+@#setdebug level=500 storage
+run job=$JobName level=Full yes
+wait
+cloud list volume=Vol1 storage=File
+messages
+END_OF_DATA
+
+run_bconsole
+
+ls -il $tmp/Vol1 | sort > $tmp/part-list-after-backup
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out $tmp/log2.out
+@#setdebug level=500 storage
+restore select all done yes where=$tmp/bacula-restores
+wait
+messages
+END_OF_DATA
+
+run_bconsole
+
+
+ls -il $tmp/Vol1 | sort > $tmp/part-list-after-restore
+
+check_for_zombie_jobs storage=File 
+stop_bacula
+
+$bin/bls -c $conf/bacula-sd.conf -V Vol1 FileStorage | grep "End of Volume"
+if [ $? != 0 ]; then
+    print_debug "ERROR: bls output is incorrect"
+    estat=1
+fi
+
+ls -il $tmp/Vol1 | sort > $tmp/part-list-after-bls
+
+if ! diff $tmp/part-list-after-backup $tmp/part-list-after-restore; then
+    print_debug "ERROR: the part list changed after the restore $tmp/part-list-after-restore $tmp/part-list-after-backup"
+    estat=1
+fi
+
+if ! diff $tmp/part-list-after-backup $tmp/part-list-after-bls; then
+    print_debug "ERROR: the part list changed after the bls $tmp/part-list-after-bls $tmp/part-list-after-backup"
+    estat=1
+fi
+
+check_two_logs
+check_restore_diff
+
+end_test