]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
regress: Add test to check json output of json tools
authorEric Bollengier <eric@baculasystems.com>
Fri, 8 Jan 2021 10:41:03 +0000 (11:41 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:02:58 +0000 (09:02 +0100)
regress/tests/json-test [new file with mode: 0755]

diff --git a/regress/tests/json-test b/regress/tests/json-test
new file mode 100755 (executable)
index 0000000..61b54a8
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/bash
+#
+# Copyright (C) 2000-2020 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# Test the configuration with json tools
+#
+TestName="json-test"
+JobName=backup
+. scripts/functions
+
+scripts/cleanup
+scripts/copy-confs
+
+cat <<EOF >> $tmp/1
+Messages {
+  Name = "Standard1"
+  MailCommand = "/usr/sbin/bsmtp -h localhost -f \"(Bacula) no-reply@homeserver \" -s \"Bacula: %t %e of %c %l\" %r"
+  OperatorCommand = "/usr/sbin/bsmtp -h localhost -f \"(Bacula) no-reply@homeserver \" -s \"Bacula: Intervention needed for %j\" %r"
+  Mail = root@localhost = All, Fatal, Error, Warning, Mount
+  Append = $working/bacula.log = !Debug, !Saved, !Skipped
+  Console = !Debug, !Saved, !Skipped
+  Operator = root@localhost = Fatal, Error, Warning, Mount
+  Catalog = All, !Debug, !Skipped, !Saved
+}
+EOF
+
+cat $tmp/1 >> $conf/bacula-dir.conf
+cat $tmp/1 >> $conf/bacula-sd.conf
+cat $tmp/1 >> $conf/bacula-fd.conf
+
+start_test
+
+$bperl -e 'check_json_tools()'
+if [ $? -ne 0 ]; then
+    print_debug "ERROR: Issue while checking json output"
+    estat=1
+fi
+end_test