Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ekneg54 committed Sep 28, 2024
1 parent ef4cbb1 commit ab05439
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/unit/connector/test_confluent_kafka_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,17 +324,17 @@ def test_offset_metrics_not_initialized_with_default_label_values(self, metric_n
def test_lost_callback_counts_warnings_and_logs(self, mock_consumer):
self.object.metrics.number_of_warnings = 0
mock_partitions = [mock.MagicMock()]
self.object._lost_callback(mock_consumer, mock_partitions)
with mock.patch("logging.Logger.warning") as mock_warning:
self.object._lost_callback(mock_consumer, mock_partitions)
mock_warning.assert_called()
assert self.object.metrics.number_of_warnings == 1

@mock.patch("logprep.connector.confluent_kafka.input.Consumer")
def test_commit_callback_sets_offset_to_0_for_special_offsets(self, _):
self.object.metrics.committed_offsets.add_with_labels = mock.MagicMock()
mock_partitions = [mock.MagicMock()]
mock_partitions[0].offset = OFFSET_BEGINNING
with mock.patch("logging.Logger.warning") as mock_warning:
self.object._commit_callback(None, mock_partitions)
mock_warning.assert_called()
self.object._commit_callback(None, mock_partitions)
expected_labels = {
"description": f"topic: test_input_raw - partition: {mock_partitions[0].partition}"
}
Expand Down

0 comments on commit ab05439

Please sign in to comment.