summaryrefslogtreecommitdiffstats
path: root/tests/stats-json.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:28:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:28:20 +0000
commitdcc721a95bef6f0d8e6d8775b8efe33e5aecd562 (patch)
tree66a2774cd0ee294d019efd71d2544c70f42b2842 /tests/stats-json.sh
parentInitial commit. (diff)
downloadrsyslog-dcc721a95bef6f0d8e6d8775b8efe33e5aecd562.tar.xz
rsyslog-dcc721a95bef6f0d8e6d8775b8efe33e5aecd562.zip
Adding upstream version 8.2402.0.upstream/8.2402.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/stats-json.sh')
-rwxr-xr-xtests/stats-json.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/stats-json.sh b/tests/stats-json.sh
new file mode 100755
index 0000000..91298d4
--- /dev/null
+++ b/tests/stats-json.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+# added 2016-03-30 by singh.janmejay
+# test for verifying stats are reported correctly json format
+# This file is part of the rsyslog project, released under ASL 2.0
+. ${srcdir:=.}/diag.sh init
+generate_conf
+add_conf '
+ruleset(name="stats") {
+ action(type="omfile" file="'${RSYSLOG_DYNNAME}'.out.stats.log")
+}
+
+module(load="../plugins/impstats/.libs/impstats" interval="1" severity="7" resetCounters="on" Ruleset="stats" bracketing="on" format="json")
+
+if ($msg == "this condition will never match") then {
+ action(name="an_action_that_is_never_called" type="omfile" file=`echo $RSYSLOG_OUT_LOG`)
+}
+'
+startup
+injectmsg_file $srcdir/testsuites/dynstats_input_1
+wait_queueempty
+wait_for_stats_flush ${RSYSLOG_DYNNAME}.out.stats.log
+echo doing shutdown
+shutdown_when_empty
+echo wait on shutdown
+wait_shutdown
+custom_content_check '{ "name": "an_action_that_is_never_called", "origin": "core.action", "processed": 0, "failed": 0, "suspended": 0, "suspended.duration": 0, "resumed": 0 }' "${RSYSLOG_DYNNAME}.out.stats.log"
+custom_assert_content_missing '@cee' "${RSYSLOG_DYNNAME}.out.stats.log"
+exit_test