1#!/bin/sh 2# 3# This script will test object deletion 4# 5. scripts/functions 6 7TestName="delete-test" 8JobName=NightlySave 9 10scripts/cleanup 11scripts/copy-test-confs 12 13# Directory to backup. 14# This directory will be created by setup_data(). 15BackupDirectory="${tmp}/data" 16 17# Use a tgz to setup data to be backuped. 18# Data will be placed at "${tmp}/data/". 19setup_data data/small.tgz 20 21# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list". 22echo "${BackupDirectory}" >${tmp}/file-list 23 24 25start_test 26 27cat <<EOF > ${cwd}/tmp/bconcmds 28@$out /dev/null 29messages 30@$out $tmp/log1.out 31label storage=File volume=TestVolume001 32run job=$JobName level=full yes 33wait 34messages 35@exec "touch ${BackupDirectory}/fr.po" 36run job=$JobName level=incremental yes 37wait 38messages 39@exec "touch ${BackupDirectory}/de.po" 40run job=$JobName level=incremental yes 41wait 42messages 43@out $tmp/log2.out 44delete jobid=3 45sql 46SELECT 'FOUND 1' FROM File WHERE JobId=3; 47SELECT 'FOUND 2' FROM JobMedia WHERE JobId=3; 48SELECT 'FOUND 3' FROM Log WHERE JobId=3; 49SELECT 'FOUND 4' FROM BaseFiles WHERE JobId=3; 50 51@out $tmp/log3.out 52delete volume=TestVolume001 yes 53sql 54SELECT 'FOUND 1' FROM File WHERE JobId IN (1,2); 55SELECT 'FOUND 2' FROM JobMedia WHERE JobId IN (1,2); 56SELECT 'FOUND 3' FROM Log WHERE JobId IN (1,2); 57SELECT 'FOUND 4' FROM BaseFiles WHERE JobId IN (1,2); 58 59quit 60EOF 61 62run_bareos 63stop_bareos 64 65check_two_logs 66 67estat=0 68 69grep -v SELECT $tmp/log2.out | grep FOUND > /dev/null 70if [ $? = 0 ]; then 71 print_debug "Found orphan records in $tmp/log2.out" 72 estat=1 73fi 74 75grep -v SELECT $tmp/log3.out | grep FOUND > /dev/null 76if [ $? = 0 ]; then 77 print_debug "Found orphan records in $tmp/log3.out" 78 estat=1 79fi 80 81end_test 82