Skip to content

Commit 6a9c77b

Browse files
committed
a test to confirm errors in searchcommands with multibyte data
1 parent d1553e5 commit 6a9c77b

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
25.7 KB
Binary file not shown.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from splunklib.searchcommands import StreamingCommand, Configuration, dispatch
2+
import gzip
3+
import os
4+
import io
5+
import sys
6+
7+
8+
def build_test_command():
9+
@Configuration()
10+
class TestSearchCommand(StreamingCommand):
11+
def stream(self, records):
12+
for record in records:
13+
yield record
14+
return TestSearchCommand()
15+
16+
17+
def get_input_file(name):
18+
return "tests/data/custom_search/" + name + ".gz"
19+
20+
21+
def test_multibyte_chunked(capsys):
22+
data = gzip.open(get_input_file("multibyte_input"))
23+
if sys.version_info.major >= 3:
24+
data = io.TextIOWrapper(data)
25+
cmd = build_test_command()
26+
cmd._process_protocol_v2(sys.argv, data, sys.stdout)

0 commit comments

Comments
 (0)