Skip to content
This repository has been archived by the owner on Mar 19, 2021. It is now read-only.

Commit

Permalink
added test for client-initiated-connection
Browse files Browse the repository at this point in the history
  • Loading branch information
joergsteffens committed Mar 14, 2016
1 parent 5dee4e3 commit 324d21d
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
1 change: 1 addition & 0 deletions DartTestfile.txt.in
Expand Up @@ -10,6 +10,7 @@ ADD_TEST(disk:allowed-jobcommand-test "@regressdir@/tests/allowed-jobcommand-tes
ADD_TEST(disk:auto-label-test "@regressdir@/tests/auto-label-test")
ADD_TEST(disk:backup-bareos-test "@regressdir@/tests/backup-bareos-test")
ADD_TEST(disk:backup-bareos-passive-test "@regressdir@/tests/backup-bareos-passive-test")
ADD_TEST(disk:backup-bareos-client-initiated-connection-test "@regressdir@/tests/reload-test")
ADD_TEST(disk:backup-to-null "@regressdir@/tests/backup-to-null")
ADD_TEST(disk:base-job-test "@regressdir@/tests/base-job-test")
ADD_TEST(disk:bconsole-test "@regressdir@/tests/bconsole-test")
Expand Down
87 changes: 87 additions & 0 deletions tests/backup-bareos-client-initiated-connection-test
@@ -0,0 +1,87 @@
#!/bin/sh
#
# Run a simple backup of the Bareos build directory
# then restore it.
#
TestName="backup-bareos-client-initiated-connection-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/bareos-dir.conf $tmp/1
sed -f ${outf} $tmp/1 >$scripts/bareos-dir.conf

dircfg=$conf/bareos-dir.conf
$bperl -e "add_attribute('$dircfg', 'Initiate Connection To Client', 'yes', 'Client')"
$bperl -e "add_attribute('$dircfg', 'Allow Connection From Client', 'no', 'Client')"

fdcfg=$conf/bareos-fd.conf
$bperl -e "add_attribute('$fdcfg', 'Address', 'localhost', 'Director')"
$bperl -e "add_attribute('$fdcfg', 'Initiate Connection To Director', 'no', 'Director')"
$bperl -e "add_attribute('$fdcfg', 'Allow Connection From Director', 'yes', 'Director')"

change_jobname BackupClient1 $JobName
start_test

cat <<END_OF_DATA >$tmp/bconcmds
@$out /dev/null
messages
@$out $tmp/log1.out
run job=$JobName yes
wait
messages
@#
@# now do a restore
@#
@$out $tmp/log2.out
restore where=$tmp/bareos-restores select all done
yes
wait
messages
quit
END_OF_DATA

run_bareos
check_for_zombie_jobs storage=File
stop_bareos

cat <<END_OF_DATA >$tmp/bconcmds
@$out /dev/null
messages
@$out $tmp/log1.out
run job=$JobName yes
wait
messages
@#
@# now do a restore
@#
@$out $tmp/log2.out
restore where=$tmp/bareos-restores select all done
yes
wait
messages
quit
END_OF_DATA

#
# Now do a second backup after making a few changes
#
touch ${cwd}/build/src/dird/*.c
echo "test test" > ${cwd}/build/src/dird/xxx
#

run_bareos
check_for_zombie_jobs storage=File
stop_bareos

check_two_logs
check_restore_diff
end_test

0 comments on commit 324d21d

Please sign in to comment.