]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
regress: Add prune-many-jobs-test
authorEric Bollengier <eric@baculasystems.com>
Thu, 15 Aug 2024 14:33:27 +0000 (16:33 +0200)
committerEric Bollengier <eric@baculasystems.com>
Wed, 4 Dec 2024 08:14:26 +0000 (09:14 +0100)
regress/tests/prune-many-jobs-test [new file with mode: 0755]

diff --git a/regress/tests/prune-many-jobs-test b/regress/tests/prune-many-jobs-test
new file mode 100755 (executable)
index 0000000..a4bd3f6
--- /dev/null
@@ -0,0 +1,79 @@
+#!/bin/sh
+#
+# Copyright (C) 2000-2021 Kern Sibbald
+# Copyright (C) 2021-2024 Bacula Systems SA
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# This script will test prune algo 
+#
+. scripts/functions
+
+TestName="prune-many-jobs-test"
+JobName=NightlySave
+
+scripts/cleanup
+scripts/copy-test-confs
+
+setup_shstore # simulate shared storage if enabled
+
+start_test
+
+echo $PWD/build/po > tmp/file-list
+
+# We want to have pruning only when doing prune command
+$bperl -e 'add_attribute("$conf/bacula-dir.conf", "AutoPrune", "No", "Client")'
+$bperl -e 'add_attribute("$conf/bacula-dir.conf", "Job Retention", "1s", "Client")'
+$bperl -e 'set_global_maximum_concurrent_jobs(100)'
+
+cat <<EOF > ${cwd}/tmp/bconcmds
+@output /dev/null
+messages
+@$out $tmp/log1.out
+label storage=File volume=TestVolume001
+run job=$JobName level=full yes
+wait
+messages
+@exec "touch $build/po/fr.po"
+EOF
+
+for i in `seq 1 3000`; do
+    echo "run job=$JobName yes" >> $tmp/bconcmds
+done
+
+cat <<EOF >> $tmp/bconcmds
+wait
+messages
+quit
+EOF
+
+run_bacula
+
+$bperl -e 'add_attribute("$conf/bacula-dir.conf", "AutoPrune", "Yes", "Client")'
+
+cat <<EOF > $tmp/bconcmds
+@$out $tmp/log1.out
+reload
+run job=$JobName level=full yes
+wait
+messages
+@$out $tmp/log2.out
+restore select all done yes where=$tmp/bacula-restores
+wait
+messages
+quit
+EOF
+
+run_bconsole
+
+
+check_for_zombie_jobs storage=File
+check_two_logs
+stop_bacula
+
+grep "Pruned 3001 Jobs for client" $tmp/log1.out > /dev/null
+if [ $? -ne 0 ]; then
+    print_debug "ERROR: Should find a large pruning list in $tmp/log1.out"
+    estat=1
+fi
+
+end_test