]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
regress: Adapt plugin-test for fileevents
authorEric Bollengier <eric@baculasystems.com>
Fri, 9 Sep 2022 16:21:30 +0000 (18:21 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:56:59 +0000 (13:56 +0200)
regress/tests/plugin-test

index b4eb9f1ef4cbfc1fbfc1d7a175a8bcab45c90c97..1f2dc725b819efc78df6b7ce2828d2088cea8660 100755 (executable)
@@ -56,10 +56,43 @@ cat <<END_OF_DATA >${cwd}/tmp/bconcmds
 llist pluginrestoreconf jobid=2
 @$out $tmp/conf
 llist pluginrestoreconf jobid=2 id=4
+@$out $tmp/events.all
+.jlist fileevents jobid=2
+@$out $tmp/events.1
+.jlist fileevents jobid=2 fileindex=4
+@$out $tmp/events.2
+.jlist fileevents jobid=2 type=d
+@$out $tmp/events.3
+.jlist fileevents jobid=2 severity=101
+quit
 END_OF_DATA
 
 run_bconsole
 
+grep "{" $tmp/events.all | perl -MJSON -e '$j = JSON::decode_json(<>); exit (scalar(@{$j->{data}}) == 11)'
+if [ $? != 1 ]; then
+    print_debug "ERROR: Should find valid json output in $tmp/events.all"
+    estat=1
+fi
+
+grep "{" $tmp/events.1 | perl -MJSON -e '$j = JSON::decode_json(<>); exit (scalar(@{$j->{data}}) == 1)'
+if [ $? != 1 ]; then
+    print_debug "ERROR: Should find valid json output in $tmp/events.1"
+    estat=1
+fi
+
+grep "{" $tmp/events.2 | perl -MJSON -e '$j = JSON::decode_json(<>); exit (scalar(@{$j->{data}}) == 0)'
+if [ $? != 1 ]; then
+    print_debug "ERROR: Should find valid json output in $tmp/events.2"
+    estat=1
+fi
+
+grep "{" $tmp/events.3 | perl -MJSON -e '$j = JSON::decode_json(<>); exit (scalar(@{$j->{data}}) == 0)'
+if [ $? != 1 ]; then
+    print_debug "ERROR: Should find valid json output in $tmp/events.3"
+    estat=1
+fi
+
 grep string1 $tmp/conf
 
 if [ $? -ne 0 ]; then
@@ -269,6 +302,9 @@ perl -ne '
  }
 ' working/*.trace
 
-estat=$?
+r=$?
+if [ $r != 0 ]; then
+    estat=$r
+fi
 
 end_test