]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
BEE Backport regress/tests/fileset-change-test
authorEric Bollengier <eric@baculasystems.com>
Wed, 2 Sep 2020 13:07:42 +0000 (15:07 +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: Eric Bollengier <eric@baculasystems.com>
Date:   Wed May 20 11:57:03 2020 +0200

    regress: Fix fileset-change-test with new job log format

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Thu Jun 6 11:14:15 2019 +0200

    regress: Add test for fileset changes

regress/tests/fileset-change-test [new file with mode: 0755]

diff --git a/regress/tests/fileset-change-test b/regress/tests/fileset-change-test
new file mode 100755 (executable)
index 0000000..36990ee
--- /dev/null
@@ -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 <<EOF >> $conf/bacula-dir.conf
+@$tmp/fileset.conf
+EOF
+
+cat <<EOF > $tmp/fileset.conf
+FileSet {
+  Name = MyFS
+  Include {
+    File = $conf/bacula-dir.conf
+  }
+}
+EOF
+
+start_test
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@output /dev/null
+messages
+@$out ${cwd}/tmp/log1.out
+label storage=File volume=TestVolume001
+quit
+END_OF_DATA
+
+run_bacula
+
+cat <<END_OF_DATA >$tmp/bconcmds
+reload
+@$out $tmp/log1.out
+run job=BackupJob yes
+wait
+messages
+show fileset=MyFS
+quit
+END_OF_DATA
+
+run_bconsole
+
+cat <<EOF > $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 <<EOF > $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 <<EOF > $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