]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
regress: Add tests for the new .jlist command
authorEric Bollengier <eric@baculasystems.com>
Wed, 31 Mar 2021 15:39:15 +0000 (17:39 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:00 +0000 (09:03 +0100)
regress/tests/jlist-test [new file with mode: 0755]

diff --git a/regress/tests/jlist-test b/regress/tests/jlist-test
new file mode 100755 (executable)
index 0000000..8107264
--- /dev/null
@@ -0,0 +1,64 @@
+#!/bin/bash
+#
+# Copyright (C) 2000-2021 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# Test the .json command
+#
+TestName="jlist-test"
+JobName=backup
+. scripts/functions
+
+scripts/cleanup
+scripts/copy-confs
+
+start_test
+
+sed -i "s/catalog = all/catalog = all, events/" $conf/bacula-dir.conf
+
+cat <<EOF > $tmp/bconcmds
+label volume=TestVolume001 storage=File1 pool=File drive=0 slot=0
+run job=BackupClient1 level=Full yes
+run job=BackupClient1 level=Full yes
+run job=BackupClient1 level=Full yes
+wait
+messages
+EOF
+
+run_bacula
+
+cat <<EOF > $tmp/bconcmds
+gui on
+.jlist events
+EOF
+
+run_bconsole | grep '^\[' > $tmp/log1.json
+
+cat <<EOF > $tmp/bconcmds
+gui on
+.jlist events limit=1
+EOF
+
+run_bconsole | grep '^\[' > $tmp/log2.json
+
+cat <<EOF > $tmp/bconcmds
+gui on
+.jlist jobs
+EOF
+
+run_bconsole | grep '^\[' > $tmp/log3.json
+
+cat <<EOF > $tmp/bconcmds
+gui on
+.jlist joblog jobid=1
+EOF
+
+run_bconsole | grep '^\[' > $tmp/log4.json
+
+for i in 1 2 3 4; do
+    $bperl -e "check_json('$tmp/log$i.json')"
+done
+
+stop_bacula
+
+end_test