]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
regress: add more checks to console-acl-test
authorEric Bollengier <eric@baculasystems.com>
Tue, 4 Apr 2023 11:07:39 +0000 (13:07 +0200)
committerEric Bollengier <eric@baculasystems.com>
Tue, 2 May 2023 07:07:18 +0000 (09:07 +0200)
regress/scripts/setup_rconsole
regress/tests/console-acl-test

index c9e2550b7371283d8ab9904a95de9529a34cd3ba..6f08ae9f14c48d1f5964d755f967c09cdb679358 100755 (executable)
@@ -12,6 +12,9 @@ sed "s/$HOST-fd/test-rst-fd/" $tmp/1 >> $conf/bacula-dir.conf
 sed "s/$HOST-fd/test-bkp-fd/" $tmp/1 >> $conf/bacula-dir.conf
 
 cat <<EOF >> $conf/bacula-dir.conf
+FileSet {
+  Name = empty
+}
 Pool {
   Name = Test
   Pool Type = Backup
index 9671b1ada6121a3150eacd9605a4ae183cf13e1c..04cf80622d7ae7b39ddb1dd2256ebc532b6eb3cd 100755 (executable)
@@ -30,6 +30,7 @@ change_jobname NightlySave $JobName
 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "Autoprune", "no", "Director")'
 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "File Retention", "2s", "Client")'
 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "File Retention", "2s", "Pool")'
+$bperl -e 'add_attribute("$conf/bacula-dir.conf", "FileSet", "empty", "Job", "RestoreFiles")'
 
 $rscripts/setup_rconsole
 
@@ -761,11 +762,23 @@ cat <<EOF > $tmp/bconcmds
 @##############################################
 @$out $fn
 restore
+1
+.
+restore
+11
+.
+restore
 11
 test1
+restore
+11
+1,2,3,4
+1
+test1
 /etc/
-done
-.
+</etc/passwd
+$cwd/build/po/
+
 quit
 EOF
 
@@ -776,6 +789,21 @@ if ! grep "No JobId selected" $fn > /dev/null; then
     estat=1
 fi
 
+if ! grep "Job not run" $fn > /dev/null; then
+    print_debug "ERROR: Should find that job did not run in $fn"
+    estat=1
+fi
+
+if ! grep "Operation not allowed" $fn > /dev/null; then
+    print_debug "ERROR: Should find a message about < input in $fn"
+    estat=1
+fi
+
+if ! grep "Bootstrap records written" $fn > /dev/null; then
+    print_debug "ERROR: Should find that the restore wrote a bootstrap in $fn"
+    estat=1
+fi
+
 # Here the client is automatically selected, and we have other jobs
 # the file
 fn=$tmp/restore9.out
@@ -1643,5 +1671,33 @@ if ! grep "Backup OK" $fn-after-purge > /dev/null; then
     estat=1
 fi
 
+# Try to restore without the fileset configured
+fn=$tmp/restore.out
+cat <<EOF > $tmp/bconcmds
+@##############################################
+@$out $fn
+.fileset
+run job=backup level=full yes
+wait
+message
+restore client=$HOST-fd
+5
+m *
+done
+yes
+wait
+message
+quit
+EOF
+
+$bin/bconsole -c $tmp/bconsole.conf.fileset < $tmp/bconcmds
+
+# It should select a different fileset by default
+# as "empty" is not available for this console
+if grep empty $fn; then
+    print_debug "ERROR: Should not find the empty fileset in $fn"
+    estat=1
+fi
+
 stop_bacula
 end_test