]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
BEE Backport regress/tests/sd-sd-test
authorEric Bollengier <eric@baculasystems.com>
Wed, 2 Sep 2020 12:56:17 +0000 (14:56 +0200)
committerEric Bollengier <eric@baculasystems.com>
Tue, 1 Mar 2022 14:36:18 +0000 (15:36 +0100)
This commit is the result of the squash of the following main commits:

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Wed May 6 22:19:26 2020 +0200

    regress: Fix sd-sd-test with FORCE_CLOUD

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Tue Mar 3 16:17:42 2020 +0100

    regress: Fix tests with FORCE_TLS

Author: Alain Spineux <alain@baculasystems.com>
Date:   Wed Oct 30 13:09:36 2019 +0100

    regress: fix dedup tests & sd-sd-test

    - sd-sd-test was stil using the old "Dedup" resource name

Author: Alain Spineux <alain@baculasystems.com>
Date:   Mon Oct 21 14:11:35 2019 +0200

    regress: sd-sd-test, add new dedup resource

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Fri Oct 18 09:23:43 2019 +0200

    regress: Find free port to run sd-sd-test

regress/tests/sd-sd-test

index c7ecabd14745039da3ce9ac2aeffa6c11c8fe335..c155a455b02605d5d0a155be53ea317cd9308695 100755 (executable)
@@ -18,29 +18,51 @@ scripts/copy-migration-confs
 scripts/prepare-disk-changer
 echo "${cwd}/build" >${cwd}/tmp/file-list
 
+# Find a free port to run the second SD
+for i in `seq 10 100`
+do
+    PORT=`expr $BASEPORT + $i`
+    if ! netstat -an | grep " $PORT " 2> /dev/null > /dev/null
+    then
+        break
+    fi
+done
 sed -e "s:$cwd/working:$cwd/working2:   " \
     -e "s:$cwd/tmp:$cwd/tmp2:" $conf/bacula-sd.conf > $conf/bacula-sd2.conf
 
 $bperl -e "add_attribute('$conf/bacula-sd2.conf', 'Name', 'sd2', 'Storage')"
-$bperl -e "add_attribute('$conf/bacula-sd2.conf', 'SDPort', $BASEPORT + 10, 'Storage')"
+$bperl -e "add_attribute('$conf/bacula-sd2.conf', 'SDPort', '$PORT', 'Storage')"
 $bperl -e "add_attribute('$conf/bacula-sd2.conf', 'Media Type', 'DiskChangerMedia2', 'Device', 'Drive-0')"
 $bperl -e "add_attribute('$conf/bacula-sd2.conf', 'Media Type', 'File2', 'Device', 'FileStorage')"
 if [ x$FORCE_DEDUP = xyes ]; then
    DEDUP_FS_OPTION=${DEDUP_FS_OPTION:-bothsides}
    $bperl -e 'add_attribute("$conf/bacula-sd2.conf", "Plugin Directory", "$plugins", "Storage")'
    $bperl -e 'add_attribute("$conf/bacula-sd2.conf", "Device Type", "Dedup", "Device")'
-   $bperl -e 'add_attribute("$conf/bacula-sd2.conf", "DedupDirectory", "${working}2", "Storage")'
-   $bperl -e 'add_attribute("$conf/bacula-sd2.conf", "MaximumContainerSize", "50MB", "Storage")'
+   $bperl -e 'add_attribute("$conf/bacula-sd2.conf", "Dedupengine", "Dedupengine-sd2", "Device")'
+   cat >> $conf/bacula-sd2.conf <<EOF
+
+Dedupengine {
+  Name = Dedupengine-sd2
+  DedupDirectory = "${working}2/dde"
+  Driver = Legacy
+}
+
+EOF
+   $bperl -e 'add_attribute("$conf/bacula-sd2.conf", "MaximumContainerSize", "50MB", "Dedup")'
 fi
 
 
 rm -rf $cwd/working2 $cwd/tmp2
-mkdir -p $cwd/working2 $cwd/tmp2
+mkdir -p $cwd/working2 $cwd/tmp2 $cwd/tmp2/cloud
 cp -r $tmp/disk-changer $cwd/tmp2
 
-$bperl -e "add_attribute('$conf/bacula-dir.conf', 'SDPort', $BASEPORT + 10, 'Storage', 'File')"
+$bperl -e "add_attribute('$conf/bacula-dir.conf', 'SDPort', '$PORT', 'Storage', 'File')"
 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'Media Type', 'File2', 'Storage', 'File')"
 
+if [ x$FORCE_TLS = xyes ]; then
+    $bperl -e "setup_sd_tls('$conf/bacula-sd2.conf')"
+fi
+
 # Here, File is pointing to SD2 and DiskChanger is pointing to SD1
 
 $bin/bacula-sd -c $conf/bacula-sd2.conf
@@ -52,6 +74,7 @@ trap "kill $pid" INT
 change_jobname NightlySave $JobName
 start_test
 
+
 #
 # Note, we first backup into Pool Default, 
 #          then Migrate into Pool Full.