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=bareos-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# start the test 39start_test 40 41# ${tmp}/bconcmds lists the bconsole commands executed by "run_bareos" 42cat <<END_OF_DATA >${tmp}/bconcmds 43messages 44@$out ${tmp}/log-config.out 45show client=${Client} 46@$out ${tmp}/log1.out w 47status all 48label storage=File1 pool=Default volume=TestVolume001 49run job=$JobName fileset=compression-fileset storage=File1 yes 50wait 51messages 52@# 53@# now do a restore 54@# 55@$out ${tmp}/log2.out w 56restore client=${Client} where=${tmp}/bareos-restores select storage=File1 57unmark * 58mark * 59done 60yes 61wait 62messages 63quit 64END_OF_DATA 65 66# Start the bareos daemons 67# and run the bconsole commands from ${tmp}/bconcmds 68# Further bconsole commands can be executed by "run_bconsole". 69run_bareos 70 71# verify that all are terminated 72check_for_zombie_jobs storage=File1 client=${Client} 73 74# stop bareos 75stop_bareos 76 77# check log files for common error messages 78check_log ${tmp}/log-config.out 79if ! grep -qi "TlsRequire = yes" ${tmp}/log-config.out; then 80 set_error "client is not configured to use TLS." 81fi 82 83check_log ${tmp}/log1.out 84check_log ${tmp}/log2.out 85 86# check tmp/log1.out and tmp/log2.out for errors 87check_two_logs 88 89# check for differences between original files and restored files 90check_restore_diff ${BackupDirectory} 91 92# do some manual testing 93if [ ! -d ${BackupDirectory} ]; then 94 set_error "Directory ${BackupDirectory} does not exists any more." 95fi 96 97# end tests and check for error codes 98end_test 99