]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
regress: Add test for PSK activation
authorEric Bollengier <eric@baculasystems.com>
Thu, 10 Mar 2022 11:50:07 +0000 (12:50 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 10 Mar 2022 13:56:31 +0000 (14:56 +0100)
regress/tests/tls-psk-test [new file with mode: 0755]

diff --git a/regress/tests/tls-psk-test b/regress/tests/tls-psk-test
new file mode 100755 (executable)
index 0000000..f47abda
--- /dev/null
@@ -0,0 +1,72 @@
+#!/usr/bin/env bash
+#
+# Copyright (C) 2000-2022 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# Run a simple backup of the Bacula build directory
+#   then restore it.
+#
+TestName="tls-psk-test"
+JobName=backup
+. scripts/functions
+
+scripts/cleanup
+scripts/copy-confs
+
+#
+# Zap out any schedule in default conf file so that
+#  it doesn't start during our test
+#
+outf="$tmp/sed_tmp"
+echo "s%  Schedule =%# Schedule =%g" >${outf}
+cp $scripts/bacula-dir.conf $tmp/1
+sed -f ${outf} $tmp/1 >$scripts/bacula-dir.conf
+
+change_jobname BackupClient1 $JobName
+start_test
+
+cat <<END_OF_DATA >$tmp/bconcmds
+@output /dev/null
+messages
+@$out $tmp/log1.out
+setdebug level=200,network,security trace=1 dir
+label volume=TestVolume001 storage=File1 pool=File slot=1 drive=0
+run job=$JobName yes
+wait
+messages
+@# 
+@# now do a restore
+@#
+@$out $tmp/log2.out  
+restore where=$tmp/bacula-restores select all done
+yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bacula
+check_for_zombie_jobs storage=File1
+stop_bacula
+
+grep "0 TLSPSK Start PSK" $working/*.trace > /dev/null
+if [ $? != 0 ]; then
+    print_debug "ERROR: Should find console PSK message in director trace"
+    estat=1
+fi
+
+nb=`grep "1 TLSPSK Start PSK" $working/*.trace | wc -l`
+if [ $nb != 2 ]; then
+    print_debug "ERROR: Should find jobid 1 PSK message in director trace"
+    estat=1
+fi
+
+nb=`grep "2 TLSPSK Start PSK" $working/*.trace | wc -l`
+if [ $nb != 2 ]; then
+    print_debug "ERROR: Should find jobid 2 PSK message in director trace"
+    estat=1
+fi
+
+check_two_logs
+check_restore_diff
+end_test