Skip to content

Commit 49f57a7

Browse files
author
Shakeel Mohamed
committed
Merge branch 'bug/segmentation' into develop
2 parents 8778bf7 + 3844e01 commit 49f57a7

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

splunklib/results.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def _parse_results(self, stream):
246246
elem.clear()
247247

248248
elif elem.tag in ('text', 'v') and event == 'end':
249-
text = elem.text if elem.text is not None else ""
249+
text = "".join(elem.itertext())
250250
values.append(text.encode('utf8'))
251251
elem.clear()
252252

tests/test_results.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,28 @@ def test_read_raw_field(self):
133133

134134
self.assert_parsed_results_equals(xml_text, expected_results)
135135

136+
def test_read_raw_field_with_segmentation(self):
137+
xml_text = """
138+
<?xml version='1.0' encoding='UTF-8'?>
139+
<results preview='0'>
140+
<meta>
141+
<fieldOrder>
142+
<field>_raw</field>
143+
</fieldOrder>
144+
</meta>
145+
<result offset='0'>
146+
<field k='_raw'><v xml:space='preserve' trunc='0'>07-13-2012 09:27:27.307 -0700 INFO Metrics - group=search_concurrency, <sg h="1">system total</sg>, <sg h="2">active_hist_searches=0</sg>, active_realtime_searches=0</v></field>
147+
</result>
148+
</results>
149+
""".strip()
150+
expected_results = [
151+
{
152+
'_raw': '07-13-2012 09:27:27.307 -0700 INFO Metrics - group=search_concurrency, system total, active_hist_searches=0, active_realtime_searches=0',
153+
},
154+
]
155+
156+
self.assert_parsed_results_equals(xml_text, expected_results)
157+
136158
def assert_parsed_results_equals(self, xml_text, expected_results):
137159
results_reader = results.ResultsReader(StringIO(xml_text))
138160
actual_results = [x for x in results_reader]

0 commit comments

Comments
 (0)