1#!/bin/sh 2 3. scripts/functions 4 5# Define the Name of the test as "TestName". 6# Should be the same as the filename, therefore we use the filename as default. 7TestName="`basename $0`" 8 9# set other test specific variables 10Client=tls-passive-fd 11JobName=backup-bareos-fd 12 13# Remove old configuration, working and tmp files. Setup the database. 14cleanup 15 16# Config files will be copied to required location. 17# Base configuration files come from the 18# configs/BASE/ directory, see 19# configs/BASE/README.txt for an overview of the provides resources. 20# Store your additonal resources to 21# configs/$TestName. 22# It is also possible to overwrite resources from configs/BASE. 23# If you define a full config file (instead of config files for individual resources), 24# only these will be taken. 25copy_configs 26 27# Directory to backup. 28# This directory will be created by setup_data(). 29BackupDirectory="${tmp}/data" 30 31# Use a tgz to setup data to be backuped. 32# Data will be placed at "${tmp}/data/". 33setup_data data/small.tgz 34 35# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list". 36echo "${BackupDirectory}" >${tmp}/file-list 37 38 39# start the test 40start_test 41 42# ${tmp}/bconcmds lists the bconsole commands executed by "run_bareos" 43cat <<END_OF_DATA >${tmp}/bconcmds 44messages 45@$out ${tmp}/log-config.out 46show client=${Client} 47@$out ${tmp}/log1.out w 48status all 49label storage=File1 pool=Default volume=TestVolume001 50run job=$JobName client=${Client} fileset=compression-fileset storage=File1 yes 51wait 52messages 53@# 54@# now do a restore 55@# 56@$out ${tmp}/log2.out w 57restore client=${Client} where=${tmp}/bareos-restores select storage=File1 58unmark * 59mark * 60done 61yes 62wait 63messages 64quit 65END_OF_DATA 66 67# Start the bareos daemons 68# and run the bconsole commands from ${tmp}/bconcmds 69# Further bconsole commands can be executed by "run_bconsole". 70run_bareos 71 72# verify that all are terminated 73check_for_zombie_jobs storage=File1 client=${Client} 74 75# stop bareos 76stop_bareos 77 78# check log files for common error messages 79check_log ${tmp}/log-config.out 80if ! grep -qi "Passive = yes" ${tmp}/log-config.out; then 81 set_error "client is not configured as passive client." 82fi 83if ! grep -qi "TlsRequire = yes" ${tmp}/log-config.out; then 84 set_error "client is not configured to use TLS." 85fi 86 87check_log ${tmp}/log1.out 88check_log ${tmp}/log2.out 89 90# check tmp/log1.out and tmp/log2.out for errors 91check_two_logs 92 93# check for differences between original files and restored files 94check_restore_diff ${BackupDirectory} 95 96# do some manual testing 97if [ ! -d ${BackupDirectory} ]; then 98 set_error "Directory ${BackupDirectory} does not exists any more." 99fi 100 101# end tests and check for error codes 102end_test 103