From: Eric Bollengier Date: Wed, 2 Sep 2020 13:07:42 +0000 (+0200) Subject: BEE Backport regress/tests/fileset-change-test X-Git-Tag: Release-11.3.2~1237 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=384bd0a2e1283ff5c45f61bd202471f5d2166af2;p=thirdparty%2Fbacula.git BEE Backport regress/tests/fileset-change-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: Wed May 20 11:57:03 2020 +0200 regress: Fix fileset-change-test with new job log format Author: Eric Bollengier Date: Thu Jun 6 11:14:15 2019 +0200 regress: Add test for fileset changes --- diff --git a/regress/tests/fileset-change-test b/regress/tests/fileset-change-test new file mode 100755 index 0000000000..36990ee729 --- /dev/null +++ b/regress/tests/fileset-change-test @@ -0,0 +1,163 @@ +#!/bin/sh +# +# Copyright (C) 2000-2020 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# Run huge number of jobs at the same time +# +TestName=fileset-change-test +JobName=BackupJob +. scripts/functions + +scripts/cleanup +scripts/copy-test-confs +echo "${cwd}/build/po/fr.po" >${cwd}/tmp/file-list + +change_jobname NightlySave $JobName + +$bperl -e 'add_attribute("$conf/bacula-dir.conf", "SpoolData", "no", "Job")' +$bperl -e 'add_attribute("$conf/bacula-dir.conf", "FileSet", "MyFS", "Job", "BackupJob")' +$bperl -e 'add_attribute("$conf/bacula-dir.conf", "AutoPrune", "No", "Director")' + +cat <> $conf/bacula-dir.conf +@$tmp/fileset.conf +EOF + +cat < $tmp/fileset.conf +FileSet { + Name = MyFS + Include { + File = $conf/bacula-dir.conf + } +} +EOF + +start_test + +cat <${cwd}/tmp/bconcmds +@output /dev/null +messages +@$out ${cwd}/tmp/log1.out +label storage=File volume=TestVolume001 +quit +END_OF_DATA + +run_bacula + +cat <$tmp/bconcmds +reload +@$out $tmp/log1.out +run job=BackupJob yes +wait +messages +show fileset=MyFS +quit +END_OF_DATA + +run_bconsole + +cat < $tmp/fileset.conf +FileSet { + Name = MyFS + Include { + File = $conf/bacula-sd.conf + } +} +EOF + +run_bconsole + +sleep 1 +$bperl -e 'add_attribute("$conf/bacula-dir.conf", "MaxFullInterval", "1s", "Job", "BackupJob")' + +run_bconsole + +cat < $tmp/fileset.conf +FileSet { + Name = MyFS + Include { + File = $conf/bacula-dir.conf + } +} +EOF + +sleep 1 +run_bconsole + +sleep 1 +$bperl -e 'add_attribute("$conf/bacula-dir.conf", "MaxFullInterval", "10min", "Job", "BackupJob")' +$bperl -e 'add_attribute("$conf/bacula-dir.conf", "MaxDiffInterval", "1s", "Job", "BackupJob")' + +run_bconsole + +cat < $tmp/fileset.conf +FileSet { + Name = MyFS + Include { + File = $conf/bacula-fd.conf + } +} +EOF + +sleep 1 +run_bconsole + +grep "1: No prior or suitable Full backup found in catalog. Doing FULL backup." $tmp/log1.out > /dev/null +if [ $? != 0 ]; then + print_debug "ERROR: The first job should print an upgrade message" + estat=1 +fi + +grep '2: The FileSet "MyFS" was modified on' $tmp/log1.out > /dev/null +if [ $? != 0 ]; then + print_debug "ERROR: The second job should print an upgrade message with the fileset modification" + estat=1 +fi + +grep '2: No prior or suitable Full backup found in catalog for the current FileSet. Doing FULL backup.' $tmp/log1.out > /dev/null +if [ $? != 0 ]; then + print_debug "ERROR: The second job should print an upgrade message" + estat=1 +fi + +grep '3: Max Full Interval exceeded. Doing FULL backup.' $tmp/log1.out > /dev/null +if [ $? != 0 ]; then + print_debug "ERROR: The third job should print an upgrade message" + estat=1 +fi + +grep '4: Max Full Interval exceeded. Doing FULL backup.' $tmp/log1.out > /dev/null +if [ $? != 0 ]; then + print_debug "ERROR: The 4th job should print an upgrade message" + estat=1 +fi + +grep '4: The FileSet was modified the "20.*" after the last backup on the "20.*".' $tmp/log1.out > /dev/null +if [ $? = 0 ]; then + print_debug "ERROR: The 4th job should NOT print an upgrade message with the fileset modification" + estat=1 +fi + +grep '5: Max Diff Interval exceeded. Doing Differential backup.' $tmp/log1.out > /dev/null +if [ $? != 0 ]; then + print_debug "ERROR: The job 5 should print an upgrade message" + estat=1 +fi + +grep '6: The FileSet "MyFS" was modified' $tmp/log1.out > /dev/null +if [ $? != 0 ]; then + print_debug "ERROR: The job 6 should print an upgrade message with the fileset modification" + estat=1 +fi + +grep '6: No prior or suitable Full backup found in catalog for the current FileSet. Doing FULL backup.' $tmp/log1.out > /dev/null +if [ $? != 0 ]; then + print_debug "ERROR: The job 6 should print an upgrade message" + estat=1 +fi + + +check_for_zombie_jobs storage=File +stop_bacula + +end_test