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

Commit

Permalink
adapted tls-duplicate-job-test to new structure.
Browse files Browse the repository at this point in the history
Fixes problem with expired certicates.
  • Loading branch information
joergsteffens committed Jun 21, 2017
1 parent 49962a5 commit 85d42bc
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 44 deletions.
@@ -0,0 +1,6 @@
Job {
Name = "AllowDuplicateYes"
JobDefs = "tls-duplicate-job"
AllowDuplicateJobs = yes
}

@@ -0,0 +1,7 @@
Job {
Name = "CancelLowerLevelDuplicatesYes"
JobDefs = "tls-duplicate-job"
AllowDuplicateJobs = no
CancelLowerLevelDuplicates=yes
}

@@ -0,0 +1,8 @@
Job {
Name = "CancelQueueDuplicatesYes"
JobDefs = "tls-duplicate-job"
AllowDuplicateJobs = no
CancelLowerLevelDuplicates=no
CancelQueuedDuplicates=yes
}

@@ -0,0 +1,9 @@
Job {
Name = "CancelRunningDuplicatesNo"
JobDefs = "tls-duplicate-job"
AllowDuplicateJobs = no
CancelLowerLevelDuplicates=no
CancelQueuedDuplicates=no
CancelRunningDuplicates=no
}

@@ -0,0 +1,9 @@
Job {
Name = "CancelRunningDuplicatesYes"
JobDefs = "tls-duplicate-job"
AllowDuplicateJobs = no
CancelLowerLevelDuplicates = no
CancelQueuedDuplicates = no
CancelRunningDuplicates = yes
}

@@ -0,0 +1,9 @@
JobDefs {
Name = "tls-duplicate-job"
JobDefs = "DefaultJob"
FileSet="compression-fileset"
ClientRunBeforeJob="sleep 2"
Max Run Time = 30min
Maximum Concurrent Jobs = 100
}

8 changes: 4 additions & 4 deletions scripts/functions
Expand Up @@ -147,12 +147,12 @@ set_debug()

print_debug()
{
echo $* | grep ERROR > /dev/null
echo "$*" | grep -q ERROR > /dev/null
if test $? -eq 0; then
echo $* >> $tmp/err.log
echo "$*" >> $tmp/err.log
fi
if test "$debug" -eq 1 ; then
echo $*
if test "$debug" -eq 1; then
echo "$*"
fi
}

Expand Down
85 changes: 45 additions & 40 deletions tests/tls-duplicate-job-test
@@ -1,55 +1,54 @@
#!/bin/sh
#
#
TestName="duplicate-job-test"
. scripts/functions

scripts/cleanup
scripts/copy-tls-confs
echo "${cwd}/build/README.NDMP" >${cwd}/tmp/file-list

# increase the maximum concurrent jobs for FD, SD and DIR
perl -Mscripts::functions -e 'set_maximum_concurrent_jobs("$conf/bareos-dir.conf",100)'
perl -Mscripts::functions -e 'set_maximum_concurrent_jobs("$conf/bareos-sd.conf",100)'
perl -Mscripts::functions -e 'set_maximum_concurrent_jobs("$conf/bareos-fd.conf",100)'

# extract a Job and add a runscript on it
perl -Mscripts::functions \
-e "extract_resource('$conf/bareos-dir.conf', 'Job', 'CompressedTest')" \
| sed 's%Standard%Standard; ClientRunBeforeJob="sleep 2"%' > $tmp/1

. scripts/functions

outf="$tmp/sed_tmp"
echo 's%CompressedTest%AllowDuplicateYes%' > $outf
echo 's%Backup%Backup; AllowDuplicateJobs = yes%' >> $outf
sed -f $outf $tmp/1 >> $conf/bareos-dir.conf
# Define the Name of the test as "TestName".
# Should be the same as the filename, therefore we use the filename as default.
TestName="`basename $0`"

echo 's%CompressedTest%CancelLowerLevelDuplicatesYes%' > $outf
echo 's%Backup%Backup; AllowDuplicateJobs = no; CancelLowerLevelDuplicates=yes%' >> $outf
sed -f $outf $tmp/1 >> $conf/bareos-dir.conf
# set other test specific variables
Client=bareos-fd
JobName=backup-bareos-fd
when=`perl -Mscripts::functions -e "get_time(300)"`

echo 's%CompressedTest%CancelQueueDuplicatesYes%' > $outf
echo 's%Backup%Backup; AllowDuplicateJobs = no;CancelLowerLevelDuplicates=no;CancelQueuedDuplicates=yes %' >> $outf
sed -f $outf $tmp/1 >> $conf/bareos-dir.conf
# Directory to backup.
# This example uses a subdirectory of the bareos source/build directory,
# that contains some file but isn't to large.
BackupDirectory="${cwd}/build/src/tests/"

# Remove old configuration, working and tmp files. Setup the database.
cleanup

# Config files will be copied to required location.
# Base configuration files come from the
# configs/BASE/ directory, see
# configs/BASE/README.txt for an overview of the provides resources.
# Store your additonal resources to
# configs/$TestName.
# It is also possible to overwrite resources from configs/BASE.
# If you define a full config file (instead of config files for individual resources),
# only these will be taken.
copy_configs

echo 's%CompressedTest%CancelRunningDuplicatesYes%' > $outf
echo 's%Backup%Backup; AllowDuplicateJobs = no;CancelLowerLevelDuplicates=no;CancelQueuedDuplicates=no; CancelRunningDuplicates=yes%' >> $outf
sed -f $outf $tmp/1 >> $conf/bareos-dir.conf
# increase the maximum concurrent jobs for FD, SD and DIR
#perl -Mscripts::functions -e 'set_maximum_concurrent_jobs("$conf/bareos-dir.conf",100)'
#perl -Mscripts::functions -e 'set_maximum_concurrent_jobs("$conf/bareos-sd.conf",100)'
#perl -Mscripts::functions -e 'set_maximum_concurrent_jobs("$conf/bareos-fd.conf",100)'

echo 's%CompressedTest%CancelRunningDuplicatesNo%' > $outf
echo 's%Backup%Backup; AllowDuplicateJobs = no;CancelLowerLevelDuplicates=no;CancelQueuedDuplicates=no; CancelRunningDuplicates=no%' >> $outf
sed -f $outf $tmp/1 >> $conf/bareos-dir.conf

when=`perl -Mscripts::functions -e "get_time(300)"`
# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list".
#echo "${cwd}/build/README.NDMP" >${cwd}/tmp/file-list
echo "${BackupDirectory}" >${tmp}/file-list

# start the test
start_test

cat <<END_OF_DATA >${cwd}/tmp/bconcmds
@$out /dev/null
messages
@$out ${cwd}/tmp/log1.out
messages
label storage=File volume=TestVolume001
label storage=File1 pool=Default volume=TestVolume001
@#setdebug level=100 storage=File
@##############################################
@# AllowDuplicates = Yes, both jobs should work
Expand Down Expand Up @@ -147,7 +146,11 @@ quit
END_OF_DATA

run_bareos
check_for_zombie_jobs storage=File

# verify that all are terminated
check_for_zombie_jobs storage=File1 client=${Client}

# stop bareos
stop_bareos

touch $tmp/log2.out
Expand All @@ -156,22 +159,24 @@ check_two_logs
grep '^| *[0-9]' $tmp/log7.out > /dev/null
if [ $? = 0 ]; then
print_debug "ERROR: Found errors in $tmp/log7.out"
print_debug `cat $tmp/log7.out`
print_debug "`cat $tmp/log7.out`"
estat=1
fi

grep '^| *[0-9]' $tmp/log8.out > /dev/null
if [ $? = 0 ]; then
print_debug "ERROR: Found errors in $tmp/log8.out"
print_debug `cat $tmp/log8.out`
print_debug "`cat $tmp/log8.out`"
estat=1
fi

nb=`grep '^| *[0-9]' $tmp/log9.out | wc -l`
if [ $nb -lt 10 ]; then
print_debug "ERROR: no enough results in $tmp/log9.out"
print_debug `cat $tmp/log9.out`
print_debug "`cat $tmp/log9.out`"
estat=1
fi

# end tests and check for error codes
end_test

0 comments on commit 85d42bc

Please sign in to comment.