uranusjr commented on code in PR #70671:
URL: https://github.com/apache/airflow/pull/70671#discussion_r4397659266
##########
airflow-core/tests/unit/utils/test_log_handlers.py:
##########
@@ -516,18 +597,26 @@ def test_read_respects_log_pos_metadata(self,
mock_read_local, create_task_insta
task_id="task_for_testing_local_log_read",
run_type=DagRunType.SCHEDULED,
logical_date=DEFAULT_DATE,
+ state=ti_state,
)
+ local_log_file_read.try_number = 1
fth = FileTaskHandler("")
- log_handler_output_stream, metadata = fth.read(
- local_log_file_read,
- try_number=1,
- metadata={"log_pos": 2},
- )
+ with (
+ patch.object(fth, "_read_from_logs_server", return_value=([], [])),
+ patch.object(fth, "_get_executor") as get_executor,
+ ):
+ get_executor.return_value.get_streaming_task_log.return_value =
([], [])
+ log_handler_output_stream, metadata = fth.read(
+ local_log_file_read,
+ try_number=1,
+ metadata={"log_pos": 2},
+ )
# Should resume from the third line only.
assert extract_events(log_handler_output_stream) == ["line 3"]
- assert metadata == {"end_of_log": True, "log_pos": 3}
+ # log_pos counts every record read so far, not only the ones returned
in this call.
+ assert metadata == expected_metadata
Review Comment:
Half the parametrization (finished) returns no log_pos, so this comment is
misleading there.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]