Skip to content

Commit fbbdf4e

Browse files
author
Shakeel Mohamed
committed
notes for search command example tests
1 parent 204b467 commit fbbdf4e

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

‎tests/searchcommands/test_examples.py‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,8 @@ def test_generating_command_configuration(self):
263263
StubbedGeneratingCommand(), 'test_generating_command_configuration')
264264

265265
def test_generating_command_in_isolation(self):
266+
# TODO: need to make sure all csv files exist at some point before running tests
267+
# TODO: this one test passes when using shell=True to Popen in _start_process
266268
self._run(
267269
'simulate', [
268270
'csv=population.csv',
@@ -286,7 +288,7 @@ def test_generating_command_on_server(self):
286288
expected, actual = self._getOneshotResults(
287289
'| simulate csv=population.csv rate=200 interval=00:00:01 duration=00:00:02 seed=%s' % TestSearchCommandsApp._seed,
288290
'test_generating_command_on_server')
289-
# self.assertMultilLineEqual(expected, actual)
291+
self.assertMultiLineEqual(expected, actual)
290292
return
291293

292294
def test_reporting_command_configuration(self):
@@ -353,6 +355,9 @@ def test_streaming_command_in_isolation(self):
353355
return
354356

355357
def test_streaming_command_on_server(self):
358+
#TODO: add integration test to updload tweets.csv relative to $SPLUNK_HOME/var/run
359+
#http://docs.splunk.com/Documentation/Splunk/6.1.3/SearchReference/Inputcsv
360+
356361
expected, actual = self._getOneshotResults(
357362
'| inputcsv tweets.csv | countmatches fieldname=word_count pattern="\\\\w+" text',
358363
'test_streaming_command_on_server')
@@ -407,7 +412,7 @@ def _getOneshotResults(self, query, test_name):
407412
actual = u'\n'.join(actual)
408413
with TestSearchCommandsApp._open_data_file('_expected_results/%s.txt' % test_name, 'r') as expected_file:
409414
expected = u''.join(expected_file.readlines())
410-
return actual, expected
415+
return expected, actual
411416

412417
def _run(self, command, args, **kwargs):
413418
for operation in ['__GETINFO__', '__EXECUTE__']:
@@ -435,6 +440,8 @@ def _open_data_file(cls, relative_path, mode):
435440

436441
@classmethod
437442
def _start_process(cls, args, stdin, stdout, stderr):
443+
# TODO: make doc note about this?
444+
# TODO: make a shell script to run some of these seperately, check results there
438445
return Popen(args, stdin=stdin, stdout=stdout, stderr=stderr, cwd=cls.app_bin)
439446

440447
package_directory = os.path.dirname(__file__)

0 commit comments

Comments
 (0)