Skip to content

Commit 8988fce

Browse files
author
Shakeel Mohamed
committed
change test data on search commands tests
1 parent 9ec3e59 commit 8988fce

5 files changed

Lines changed: 19 additions & 12 deletions

File tree

‎splunklib/searchcommands/search_command.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def __init__(self):
5757
u'If you are testing outside of Splunk, consider running under control of the Splunk CLI:\n'
5858
u' splunk cmd %s\n'
5959
u'If you are running inside of Splunk, SPLUNK_HOME should be defined. Consider troubleshooting your '
60-
u'installation.')
60+
u'installation.', self)
6161

6262
# Variables backing option/property values
6363

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
changes_colorder=True, clear_required_fields=True, enableheader=True, generating=False, maxinputs=0, needs_empty_results=True, outputheader=True, passauth=False, perf_warn_limit=0, required_fields=foo, requires_preop=False, requires_srinfo=False, retainsevents=False, run_in_preview=True, stderr_dest=log, streaming=False, streaming_preop=stubbedreporting __map__ boolean=false duration="00:00:10" fieldname="foo" file={file} integer=10 optionname="foo_bar" regularexpression="\\w+" set="foo", supports_multivalues=True, supports_rawargs=True
1+
changes_colorder=True, clear_required_fields=True, enableheader=True, generating=False, maxinputs=0, needs_empty_results=True, outputheader=True, passauth=False, perf_warn_limit=0, required_fields=foo, requires_preop=False, requires_srinfo=False, retainsevents=False, run_in_preview=True, stderr_dest=log, streaming=False, streaming_preop=stubbedreporting __map__ boolean="f" duration="00:00:10" fieldname="foo" file={file} integer="10" optionname="foo_bar" regularexpression="\\w+" set="foo", supports_multivalues=True, supports_rawargs=True

‎tests/searchcommands/test_search_command.py‎

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,14 @@ def test_process(self):
5555

5656
expected = \
5757
'\r\n' \
58-
'ERROR,__mv_ERROR' \
58+
'ERROR' \
5959
'\r\n' \
60-
'Command search appears to be statically configured and static configuration is unsupported by splunklib.searchcommands. Please ensure that default/commands.conf contains this stanza: [search] | filename = foo.py | supports_getinfo = true | supports_rawargs = true | outputheader = true,' \
60+
'"NotImplementedError at ' \
61+
'\"\"' + \
62+
os.path.abspath(os.path.join(os.path.dirname(__file__), "../../splunklib/searchcommands/search_command.py")) + \
63+
'\"\"' \
64+
', line 332 : ' \
65+
'Command search appears to be statically configured and static configuration is unsupported by splunklib.searchcommands. Please ensure that default/commands.conf contains this stanza:\n[search]\nfilename = foo.py\nsupports_getinfo = true\nsupports_rawargs = true\noutputheader = true"' \
6166
'\r\n'
6267

6368
command = SearchCommand()
@@ -89,8 +94,9 @@ def test_process(self):
8994

9095
expected = \
9196
'\r\n' \
92-
'ERROR,__mv_ERROR\r\n' \
93-
'Unrecognized option: undefined_option = value,\r\n'
97+
'ERROR\r\n' \
98+
'"ValueError at ""/Users/smohamed/git/splunk-sdk-python/splunklib/searchcommands/search_command_internals.py"", line 282 : ' \
99+
'Unrecognized option: undefined_option = value"\r\n'
94100

95101
command = SearchCommand()
96102
result = StringIO()
@@ -105,8 +111,9 @@ def test_process(self):
105111

106112
expected = \
107113
'\r\n' \
108-
'ERROR,__mv_ERROR\r\n' \
109-
'Unrecognized option: undefined_option = value,\r\n'
114+
'ERROR\r\n' \
115+
'"ValueError at ""/Users/smohamed/git/splunk-sdk-python/splunklib/searchcommands/search_command_internals.py"", line 282 : ' \
116+
'Unrecognized option: undefined_option = value"\r\n'
110117

111118
command = SearchCommand()
112119
result = StringIO()
@@ -127,8 +134,8 @@ def test_process(self):
127134

128135
expected = \
129136
'\r\n' \
130-
'ERROR,__mv_ERROR\r\n' \
131-
'\'NoneType\' object is not iterable,\r\n'
137+
'ERROR\r\n' \
138+
'"TypeError at ""/Users/smohamed/git/splunk-sdk-python/splunklib/searchcommands/splunk_csv/dict_reader.py"", line 38 : \'NoneType\' object is not iterable"\r\n'
132139

133140
command = SearchCommand()
134141
result = StringIO()

‎tests/searchcommands/test_search_command_internals.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def test_command_parser(self):
170170
command_line = str(command)
171171

172172
self.assertEqual(
173-
'stubbedstreaming boolean=true duration="00:00:10" fieldname="word_count" file=%s integer=10 optionname="foo_bar" regularexpression="\\\\w+" set="foo" field_1 field_2 field_3' % encoder.encode(file_path),
173+
'stubbedstreaming boolean="t" duration="00:00:10" fieldname="word_count" file=%s integer="10" optionname="foo_bar" regularexpression="\\\\w+" set="foo" field_1 field_2 field_3' % encoder.encode(file_path),
174174
command_line)
175175

176176
for option in options:

‎tests/searchcommands/test_validators.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def test_duration(self):
6868

6969
return
7070

71-
def test_file(self):
71+
def test_file_permissions_in_splunk(self):
7272

7373
# Create a file on $SPLUNK_HOME/var/run/splunk
7474

0 commit comments

Comments
 (0)