1#!/bin/sh 2# 3# What to test 4# ------------ 5# - Normal backup 6# - Weird backup 7# - Restore 8# - Accurate backup 9# - Compression 10# - Checksum 11# - TLS/Encryption 12# - compare files 13# - runscript 14# 15# How to use this test 16# -------------------- 17# 18# 19TestName="remote-fd-test" 20JobName=backup 21. scripts/functions 22 23scripts/cleanup 24scripts/copy-test-confs 25 26change_jobname NightlySave $JobName 27change_jobname MonsterSave AccurateTest 28 29start_test 30 31echo $REMOTE_FILE/save > $tmp/file-list 32 33ssh $REMOTE_ADDR test -x /opt/bareos/bin/bareos-fd 34if [ $? != 0 ]; then 35 print_debug "ERROR: Need to install bareos on $REMOTE_ADDR" 36 echo "ERROR: Need to install bareos on $REMOTE_ADDR" 37 exit 1 38fi 39 40$bperl -e remote_stop 41$bperl -e remote_init 42$bperl -e remote_config 43cfg=$conf/bareos-dir.conf 44$bperl -e "add_attribute('$cfg', 'clientrunbeforejob', '$REMOTE_FILE/save/test.sh', 'Job', 'CompressedTest')" 45$bperl -e "add_attribute('$cfg', 'accurate', 'yes', 'Job', 'AccurateTest')" 46$bperl -e "add_attribute('$cfg', 'address', '$REMOTE_ADDR', 'Client')" 47$bperl -e "add_attribute('$cfg', 'password', '$REMOTE_PASSWORD', 'Client')" 48$bperl -e "add_attribute('$cfg', 'address', '$REMOTE_STORE_ADDR', 'Storage')" 49 50cat <<END_OF_DATA >${cwd}/tmp/bconcmds 51@output 52messages 53@$out ${cwd}/tmp/log4.out 54status client 55@$out ${cwd}/tmp/log1.out 56label storage=File volume=TestVolume001 57run job=$JobName storage=File yes 58wait 59messages 60@# 61@# now do a restore 62@# 63@$out ${cwd}/tmp/log2.out 64restore where=$REMOTE_FILE/restore select all done storage=File 65yes 66wait 67messages 68@$out ${cwd}/tmp/log3.out 69@# 70@# make some runscript tests 71@# 72run job=CompressedTest storage=File yes 73wait 74messages 75@$out ${cwd}/tmp/log1.out 76@# 77@# make some accurate tests 78@# 79run job=AccurateTest storage=File yes 80wait 81messages 82run job=AccurateTest storage=File yes 83wait 84messages 85@output 86quit 87END_OF_DATA 88 89run_bareos 90check_for_zombie_jobs storage=File 91stop_bareos 92 93check_two_logs 94 95version=`$bin/bareos-dir -? | awk '/Version:/ { print $2 }'` 96version_fd=`awk '/Version:/ { print $3 }' $tmp/log4.out` 97 98if [ "$version" != "$version_fd" ]; then 99 print_debug "ERROR: client version doesn't match $version ($version_fd)" 100 estat=1 101fi 102 103grep 'this is a script' $tmp/log3.out > /dev/null 104if [ $? != 0 ]; then 105 print_debug "ERROR: Can't find runscript output" 106 bstat=1 107fi 108 109$bperl -e remote_diff 110if [ $? != 0 ]; then 111 dstat=1 112fi 113 114$bperl -e remote_stop 115 116end_test 117