summaryrefslogtreecommitdiffstats
path: root/tests/sparse_array_lookup_table.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/sparse_array_lookup_table.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/sparse_array_lookup_table.sh')
-rwxr-xr-xtests/sparse_array_lookup_table.sh64
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/sparse_array_lookup_table.sh b/tests/sparse_array_lookup_table.sh
new file mode 100755
index 0000000..bb23959
--- /dev/null
+++ b/tests/sparse_array_lookup_table.sh
@@ -0,0 +1,64 @@
+#!/bin/bash
+# test for sparse-array lookup-table and HUP based reloading of it
+# added 2015-10-30 by singh.janmejay
+# This file is part of the rsyslog project, released under ASL 2.0
+. ${srcdir:=.}/diag.sh init
+generate_conf
+add_conf '
+lookup_table(name="xlate" file="'$RSYSLOG_DYNNAME'.xlate_array.lkp_tbl")
+
+template(name="outfmt" type="string" string="%msg% %$.lkp%\n")
+
+set $.num = field($msg, 58, 2);
+
+set $.lkp = lookup("xlate", $.num);
+
+action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt")
+'
+cp -f $srcdir/testsuites/xlate_sparse_array.lkp_tbl $RSYSLOG_DYNNAME.xlate_array.lkp_tbl
+startup
+injectmsg 0 1
+wait_queueempty
+assert_content_missing "foo"
+injectmsg 0 5
+wait_queueempty
+content_check "msgnum:00000001: foo_old"
+content_check "msgnum:00000002: foo_old"
+content_check "msgnum:00000003: bar_old"
+content_check "msgnum:00000004: bar_old"
+assert_content_missing "baz"
+cp -f $srcdir/testsuites/xlate_sparse_array_more.lkp_tbl $RSYSLOG_DYNNAME.xlate_array.lkp_tbl
+issue_HUP
+await_lookup_table_reload
+injectmsg 0 6
+wait_queueempty
+content_check "msgnum:00000000: foo_new"
+content_check "msgnum:00000001: foo_new"
+content_check "msgnum:00000002: bar_new"
+content_check "msgnum:00000003: bar_new"
+content_check "msgnum:00000004: baz"
+content_check "msgnum:00000005: baz"
+cp -f $srcdir/testsuites/xlate_sparse_array_more_with_duplicates_and_nomatch.lkp_tbl $RSYSLOG_DYNNAME.xlate_array.lkp_tbl
+issue_HUP
+await_lookup_table_reload
+injectmsg 0 15
+echo doing shutdown
+shutdown_when_empty
+echo wait on shutdown
+wait_shutdown
+content_check "msgnum:00000000: quux"
+content_check "msgnum:00000001: quux"
+content_check "msgnum:00000002: foo_latest"
+content_check "msgnum:00000003: baz_latest"
+content_check "msgnum:00000004: foo_latest"
+content_check "msgnum:00000005: foo_latest"
+content_check "msgnum:00000006: foo_latest"
+content_check "msgnum:00000007: foo_latest"
+content_check "msgnum:00000008: baz_latest"
+content_check "msgnum:00000009: baz_latest"
+content_check "msgnum:00000010: baz_latest"
+content_check "msgnum:00000011: baz_latest"
+content_check "msgnum:00000012: foo_latest"
+content_check "msgnum:00000013: foo_latest"
+content_check "msgnum:00000014: foo_latest"
+exit_test