Skip to content

Commit 5d3a61f

Browse files
author
Cecylia Borek
committed
debug: csc test
1 parent 2b63865 commit 5d3a61f

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ jobs:
4444
- name: Install tox
4545
run: pip install tox
4646

47-
- name: Test Execution
48-
run: tox -e py
47+
- name: Debug Test Execution
48+
run: tox -e py39 -- -s tests/searchcommands/test_csc_apps.py
4949
fossa-scan:
5050
uses: splunk/oss-scanning-public/.github/workflows/oss-scan.yml@main
5151
secrets: inherit

splunklib/results.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ def _parse_results(self, stream):
327327
if strip_line.__len__() == 0:
328328
continue
329329
parsed_line = json_loads(strip_line)
330+
print(f"JSONResultReader: Parsed line: {parsed_line}")
330331
if "preview" in parsed_line:
331332
self.is_preview = parsed_line["preview"]
332333
if "messages" in parsed_line and parsed_line["messages"].__len__() > 0:

tests/searchcommands/test_csc_apps.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@
1414
# License for the specific language governing permissions and limitations
1515
# under the License.
1616

17+
import logging
1718
import unittest
1819
import pytest
1920

21+
import splunklib
2022
from tests import testlib
2123
from splunklib import results
2224

25+
splunklib.setup_logging(logging.DEBUG)
26+
2327

2428
@pytest.mark.smoke
2529
class TestCSC(testlib.SDKTestCase):
@@ -64,13 +68,29 @@ def test_eventing_app(self):
6468
self.assertEqual(state.title, "eventing_app")
6569

6670
jobs = self.service.jobs
71+
72+
test_index_stream = jobs.oneshot(
73+
'search index="_internal" | head 10', output_mode='json'
74+
)
75+
test_reader = results.JSONResultsReader(test_index_stream)
76+
test_items = list(test_reader)
77+
78+
print("DEBUG: Test items from _internal index stream:")
79+
for item in test_items:
80+
print(item)
81+
6782
stream = jobs.oneshot(
6883
'search index="_internal" | fields status | head 4000 | eventingcsc status=200 | head 10',
6984
output_mode='json',
7085
)
86+
7187
reader = results.JSONResultsReader(stream)
7288
items = list(reader)
7389

90+
print("DEBUG: Items from eventingcsc command:")
91+
for item in items:
92+
print(item)
93+
7494
actual_results = [item for item in items if isinstance(item, dict)]
7595
informational_messages = [
7696
item for item in items if isinstance(item, results.Message)

0 commit comments

Comments
 (0)