Lee-W commented on code in PR #49470:
URL: https://github.com/apache/airflow/pull/49470#discussion_r2160924883
##########
airflow-core/tests/unit/utils/test_log_handlers.py:
##########
@@ -724,34 +775,244 @@ def test_parse_timestamps():
]
+def test__sort_key():
+ # assert _sort_key should return int
+ assert
isinstance(_create_sort_key(pendulum.parse("2022-11-16T00:05:54.278000-08:00"),
10), int)
+
+
[email protected](
+ "timestamp, line_num, expected",
+ [
+ pytest.param(
+ pendulum.parse("2022-11-16T00:05:54.278000-08:00"),
+ 10,
+ False,
+ id="normal_timestamp_1",
+ ),
+ pytest.param(
+ pendulum.parse("2022-11-16T00:05:54.457000-08:00"),
+ 2025,
+ False,
+ id="normal_timestamp_2",
+ ),
+ pytest.param(
+ DEFAULT_SORT_DATETIME,
+ 200,
+ True,
+ id="default_timestamp",
+ ),
+ ],
+)
+def test__is_sort_key_with_default_timestamp(timestamp, line_num, expected):
+ assert _is_sort_key_with_default_timestamp(_create_sort_key(timestamp,
line_num)) == expected
+
+
[email protected](
+ "log_stream, expected",
+ [
+ pytest.param(
+ convert_list_to_stream(
+ [
+ "2022-11-16T00:05:54.278000-08:00",
+ "2022-11-16T00:05:54.457000-08:00",
+ ]
+ ),
+ True,
+ id="normal_log_stream",
+ ),
+ pytest.param(
+ itertools.chain(
+ [
+ "2022-11-16T00:05:54.278000-08:00",
+ "2022-11-16T00:05:54.457000-08:00",
+ ],
+ convert_list_to_stream(
+ [
+ "2022-11-16T00:05:54.278000-08:00",
+ "2022-11-16T00:05:54.457000-08:00",
+ ]
+ ),
+ ),
+ True,
+ id="chain_log_stream",
+ ),
+ pytest.param(
+ [
+ "2022-11-16T00:05:54.278000-08:00",
+ "2022-11-16T00:05:54.457000-08:00",
+ ],
+ False,
+ id="non_stream_log",
+ ),
+ ],
+)
+def test__is_logs_stream_like(log_stream, expected):
+ assert _is_logs_stream_like(log_stream) == expected
+
+
+def test__add_log_from_parsed_log_streams_to_heap():
Review Comment:
Thanks a lot!
--
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]