blob: 7d20c9c83850cfcd429d7d973f40d6033ab9b76d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
#!/bin/bash
# added 2015-12-02 by singh.janmejay
# test for sparse-array lookup-table and HUP based reloading of it
# 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.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")
'
echo "empty file..."
cp -f $srcdir/testsuites/xlate_empty_file.lkp_tbl $RSYSLOG_DYNNAME.xlate.lkp_tbl
startup
injectmsg 0 5
wait_queueempty
echo "table with invalid-json..."
cp -f $srcdir/testsuites/xlate_invalid_json.lkp_tbl $RSYSLOG_DYNNAME.xlate.lkp_tbl
issue_HUP
await_lookup_table_reload
injectmsg 0 5
wait_queueempty
echo "string-table with no index-key..."
cp -f $srcdir/testsuites/xlate_string_no_index.lkp_tbl $RSYSLOG_DYNNAME.xlate.lkp_tbl
issue_HUP
await_lookup_table_reload
injectmsg 0 5
wait_queueempty
assert_content_missing "foo"
assert_content_missing "bar"
assert_content_missing "baz"
echo "array-table with no index-key..."
cp -f $srcdir/testsuites/xlate_array_no_index.lkp_tbl $RSYSLOG_DYNNAME.xlate.lkp_tbl
issue_HUP
await_lookup_table_reload
injectmsg 0 5
wait_queueempty
assert_content_missing "foo"
assert_content_missing "bar"
assert_content_missing "baz"
echo "sparse-array-table with no index-key..."
cp -f $srcdir/testsuites/xlate_sparseArray_no_index.lkp_tbl $RSYSLOG_DYNNAME.xlate.lkp_tbl
issue_HUP
await_lookup_table_reload
injectmsg 0 5
wait_queueempty
assert_content_missing "foo"
assert_content_missing "bar"
assert_content_missing "baz"
echo "string-table with no value..."
cp -f $srcdir/testsuites/xlate_string_no_value.lkp_tbl $RSYSLOG_DYNNAME.xlate.lkp_tbl
issue_HUP
await_lookup_table_reload
injectmsg 0 5
wait_queueempty
assert_content_missing "baz"
echo "array-table with no value..."
cp -f $srcdir/testsuites/xlate_array_no_value.lkp_tbl $RSYSLOG_DYNNAME.xlate.lkp_tbl
issue_HUP
await_lookup_table_reload
injectmsg 0 5
wait_queueempty
assert_content_missing "baz"
echo "sparse-array-table with no value..."
cp -f $srcdir/testsuites/xlate_sparseArray_no_value.lkp_tbl $RSYSLOG_DYNNAME.xlate.lkp_tbl
issue_HUP
await_lookup_table_reload
injectmsg 0 5
wait_queueempty
assert_content_missing "baz"
echo "incorrect-version in lookup-table..."
cp -f $srcdir/testsuites/xlate_incorrect_version.lkp_tbl $RSYSLOG_DYNNAME.xlate.lkp_tbl
issue_HUP
await_lookup_table_reload
injectmsg 0 5
wait_queueempty
assert_content_missing "foo"
assert_content_missing "bar"
assert_content_missing "baz"
echo "incorrect-type in lookup-table..."
cp -f $srcdir/testsuites/xlate_incorrect_type.lkp_tbl $RSYSLOG_DYNNAME.xlate.lkp_tbl
issue_HUP
await_lookup_table_reload
injectmsg 0 5
wait_queueempty
assert_content_missing "foo"
assert_content_missing "bar"
assert_content_missing "baz"
echo "string-table with no table..."
cp -f $srcdir/testsuites/xlate_string_no_table.lkp_tbl $RSYSLOG_DYNNAME.xlate.lkp_tbl
issue_HUP
await_lookup_table_reload
injectmsg 0 5
wait_queueempty
assert_content_missing "baz"
echo "array-table with no table..."
cp -f $srcdir/testsuites/xlate_array_no_table.lkp_tbl $RSYSLOG_DYNNAME.xlate.lkp_tbl
issue_HUP
await_lookup_table_reload
injectmsg 0 5
wait_queueempty
assert_content_missing "baz"
echo "sparse-array-table with no table..."
cp -f $srcdir/testsuites/xlate_sparseArray_no_table.lkp_tbl $RSYSLOG_DYNNAME.xlate.lkp_tbl
issue_HUP
await_lookup_table_reload
injectmsg 0 5
wait_queueempty
assert_content_missing "baz"
echo "string-table with empty table..."
cp -f $srcdir/testsuites/xlate_string_empty_table.lkp_tbl $RSYSLOG_DYNNAME.xlate.lkp_tbl
issue_HUP
await_lookup_table_reload
injectmsg 0 2
wait_queueempty
content_check "msgnum:00000000: baz_str"
content_check "msgnum:00000001: baz_str"
echo "array-table with empty table..."
cp -f $srcdir/testsuites/xlate_array_empty_table.lkp_tbl $RSYSLOG_DYNNAME.xlate.lkp_tbl
issue_HUP
await_lookup_table_reload
injectmsg 0 2
wait_queueempty
content_check "msgnum:00000000: baz_arr"
content_check "msgnum:00000001: baz_arr"
echo "sparse-array-table with empty table..."
cp -f $srcdir/testsuites/xlate_sparseArray_empty_table.lkp_tbl $RSYSLOG_DYNNAME.xlate.lkp_tbl
issue_HUP
await_lookup_table_reload
injectmsg 0 2
wait_queueempty
content_check "msgnum:00000000: baz_sparse_arr"
content_check "msgnum:00000001: baz_sparse_arr"
echo doing shutdown
shutdown_when_empty
echo wait on shutdown
wait_shutdown
exit_test
|