|
63 | 63 |
|
64 | 64 | PRINT_CONFIG_ITEM_ACTION = os.path.join(tests_base.get_resources_path(), 'packs', |
65 | 65 | 'pythonactions/actions/print_config_item_doesnt_exist.py') |
| 66 | +PRINT_TO_STDOUT_STDERR_ACTION = os.path.join(tests_base.get_resources_path(), 'packs', |
| 67 | + 'pythonactions/actions/print_to_stdout_and_stderr.py') |
66 | 68 |
|
67 | 69 |
|
68 | 70 | # Note: runner inherits parent args which doesn't work with tests since test pass additional |
@@ -417,26 +419,19 @@ def test_real_time_output_streaming_bufsize(self): |
417 | 419 | group='actionrunner') |
418 | 420 |
|
419 | 421 | output_dbs = ActionExecutionOutput.get_all() |
420 | | - self.assertEqual(len(output_dbs), (index - 1) * 3) |
| 422 | + self.assertEqual(len(output_dbs), (index - 1) * 4) |
421 | 423 |
|
422 | 424 | runner = self._get_mock_runner_obj() |
423 | | - runner.runner_parameters = {'log_level': 'INFO'} |
424 | | - runner.entry_point = PASCAL_ROW_ACTION_PATH |
| 425 | + runner.entry_point = PRINT_TO_STDOUT_STDERR_ACTION |
425 | 426 | runner.pre_run() |
426 | | - (_, output, _) = runner.run({'row_index': 2}) |
| 427 | + (_, output, _) = runner.run({'stdout_count': 2, 'stderr_count': 2}) |
427 | 428 |
|
428 | | - expected_stderr = ''.join([ |
429 | | - 'st2.actions.python.PascalRowAction: INFO test info log message\n', |
430 | | - 'st2.actions.python.PascalRowAction: ERROR test error log message\n' |
431 | | - ]) |
432 | | - |
433 | | - self.assertEqual(output['stdout'], 'Pascal row action\n') |
434 | | - self.assertEqual(output['stderr'], expected_stderr) |
435 | | - self.assertEqual(output['result'], [1, 2, 1]) |
| 429 | + self.assertEqual(output['stdout'], 'stdout line 0\nstdout line 1\n') |
| 430 | + self.assertEqual(output['stderr'], 'stderr line 0\nstderr line 1\n') |
436 | 431 | self.assertEqual(output['exit_code'], 0) |
437 | 432 |
|
438 | 433 | output_dbs = ActionExecutionOutput.get_all() |
439 | | - self.assertEqual(len(output_dbs), (index) * 3) |
| 434 | + self.assertEqual(len(output_dbs), (index) * 4) |
440 | 435 |
|
441 | 436 | @mock.patch('st2common.util.concurrency.subprocess_popen') |
442 | 437 | def test_stdout_interception_and_parsing(self, mock_popen): |
|
0 commit comments