diff --git a/CHANGELOG.md b/CHANGELOG.md index b8f5a72d0..0a1682f95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/logprep/framework/pipeline.py b/logprep/framework/pipeline.py index 1d7a35ea6..06d1894c4 100644 --- a/logprep/framework/pipeline.py +++ b/logprep/framework/pipeline.py @@ -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: diff --git a/tests/unit/framework/test_pipeline.py b/tests/unit/framework/test_pipeline.py index 2f30825a6..4c4a2f36f 100644 --- a/tests/unit/framework/test_pipeline.py +++ b/tests/unit/framework/test_pipeline.py @@ -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):