From a1e1cbc089e282ddbb178ec93012a97564104776 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Wed, 13 Jul 2022 14:25:38 +0200 Subject: [PATCH] regress: Add test to check MaximumFileSize directive --- regress/tests/maxfilesize-test | 66 ++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 regress/tests/maxfilesize-test diff --git a/regress/tests/maxfilesize-test b/regress/tests/maxfilesize-test new file mode 100755 index 000000000..786114121 --- /dev/null +++ b/regress/tests/maxfilesize-test @@ -0,0 +1,66 @@ +#!/bin/sh +# +# Copyright (C) 2000-2021 Kern Sibbald +# Copyright (C) 2021-2022 Bacula Systems SA +# License: BSD 2-Clause; see file LICENSE-FOSS +# + +# +# Run a job and play with Maximum File Size to create +# JobMedia +# +TestName="maxfilesize-test" +JobName=maxsize +. scripts/functions + +scripts/cleanup +scripts/copy-test-confs +echo "$tmp/file" >${cwd}/tmp/file-list + +dd if=/dev/zero of=$tmp/file count=10000 + +$bperl -e 'add_attribute("$conf/bacula-sd.conf", "MaximumFileSize", "1MB", "Device")' +$bperl -e 'add_attribute("$conf/bacula-dir.conf", "LabelFormat", "Vol", "Pool")' +sed 's/sparse=yes;//' $conf/bacula-dir.conf > $tmp/1 +cp -f $tmp/1 $conf/bacula-dir.conf + +change_jobname NightlySave $JobName +start_test + +cat <${cwd}/tmp/bconcmds +@output /dev/null +messages +@$out $tmp/log1.out +@#setdebug level=50 trace=1 tags=volume Storage=File1 +run job=$JobName level=Full Storage=File1 yes +wait +messages +@$out $tmp/log1-json.out +.jlist jobmedia +list jobmedia +@# +@# now do a restore +@# +@$out $tmp/log2.out +restore where=${cwd}/tmp/bacula-restores select storage=File1 +unmark * +mark * +done +yes +wait +messages +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=File1 +stop_bacula + +cat $tmp/log1-json.out | grep '{' | perl -MJSON -e '$l = <>; $j = JSON::decode_json($l) ; exit (scalar(@{$j->{data}}) > 1);' +if [ $? != 1 ]; then + print_debug "ERROR: Should find more than 1 JobMedia in $tmp/log1-json.out" + estat=1 +fi + +check_two_logs +end_test -- 2.47.3