Skip to content

Commit

Permalink
fix http input bug (#657)
Browse files Browse the repository at this point in the history
* update changelog
* fix bug in http input where result is not accessible
  • Loading branch information
djkhl authored Aug 29, 2024
1 parent 086d8e9 commit f6aa076
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* fixes a bug not increasing but decreasing timeout throttle factor of ThrottlingQueue
* handle DecodeError and unexpected Exceptions on requests in `http_input` separately

* fixes unbound local error in http input connector

## 13.1.1
### Improvements

Expand Down
1 change: 1 addition & 0 deletions logprep/framework/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ def process_pipeline(self) -> PipelineResult:
Component.run_pending_tasks()

event = self._get_event()
result = None
if not event:
return None, None
if self._pipeline:
Expand Down
9 changes: 9 additions & 0 deletions tests/unit/framework/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,15 @@ def test_pipeline_result_provides_event_received(self, _):
assert result.event_received == {"some": "event"}, "received event is as expected"
assert result.event == {"some": "event", "field": "foo"}, "processed event is as expected"

def test_process_event_can_be_bypassed_with_no_pipeline(self, _):
self.pipeline._pipeline = []
self.pipeline._input.get_next.return_value = ({"some": "event"}, None)
with mock.patch("logprep.framework.pipeline.Pipeline.process_event") as mock_process_event:
mock_process_event.return_value = None
result = self.pipeline.process_pipeline()
mock_process_event.assert_not_called()
assert isinstance(result, type(None))


class TestPipelineWithActualInput:
def setup_method(self):
Expand Down

0 comments on commit f6aa076

Please sign in to comment.