From: Eric Bollengier Date: Wed, 2 Sep 2020 13:06:53 +0000 (+0200) Subject: BEE Backport regress/tests/dynamic-client-address-test X-Git-Tag: Release-11.3.2~1239 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3fee3b88b5eb8ef9ae8b4ac0b3cd4c467eef1c4b;p=thirdparty%2Fbacula.git BEE Backport regress/tests/dynamic-client-address-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 1 15:22:44 2019 +0200 regress: Add test for dynamic client address --- diff --git a/regress/tests/dynamic-client-address-test b/regress/tests/dynamic-client-address-test new file mode 100755 index 0000000000..7b633b2854 --- /dev/null +++ b/regress/tests/dynamic-client-address-test @@ -0,0 +1,88 @@ +#!/bin/sh +# +# Copyright (C) 2000-2020 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# Test the Address = "|my script" Client field +# +TestName="dynamic-client-address-test" +JobName=backup +. scripts/functions + +scripts/cleanup +scripts/copy-confs + +# +# Zap out any schedule in default conf file so that +# it doesn't start during our test +# +outf="$tmp/sed_tmp" +echo "s% Schedule =%# Schedule =%g" >${outf} +cp $scripts/bacula-dir.conf $tmp/1 +sed -f ${outf} $tmp/1 >$scripts/bacula-dir.conf + +change_jobname BackupClient1 $JobName +start_test + +$bperl -e "add_attribute('$conf/bacula-dir.conf', 'Address', '|echo 127.0.0.11', 'Client')" + +cat <$tmp/bconcmds +@output /dev/null +messages +@$out $tmp/log1.out +label volume=TestVolume001 storage=File1 pool=File slot=1 drive=0 +show client +status client +estimate job=$JobName +run job=$JobName yes +wait +messages +@# +@# now do a restore +@# +@$out $tmp/log2.out +setdebug level=4 storage=File1 +restore where=$tmp/bacula-restores select all done +yes +wait +messages +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=File1 + +nb=`grep "127.0.0.11" $tmp/log1.out | wc -l` +if [ $nb != 3 ]; then + print_debug "ERROR: Should find 5 times the ip address in $tmp/log1.out" + estat=1 +fi + +grep "echo 127.0.0.11" $tmp/log1.out > /dev/null +if [ $? != 0 ]; then + print_debug "ERROR: Should find the command $tmp/log1.out" + estat=1 +fi + +$bperl -e "add_attribute('$conf/bacula-dir.conf', 'Address', '|aaaaa', 'Client')" +cat <$tmp/bconcmds +@$out $tmp/log3.out +reload +status client +estimate job=$JobName +messages +quit +END_OF_DATA + +run_bconsole + +nb=`grep "invalid address" $tmp/log3.out| wc -l` +if [ $nb != 4 ]; then + print_debug "ERROR: Should find 4 times 'invalid address' in $tmp/log3.out" + estat=1 +fi + +stop_bacula +check_two_logs +check_restore_diff +end_test