This is an automated email from the ASF dual-hosted git repository.
gopidesu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 3545cde50c2 Bugfix/caplog flaky test in extra operator link test
(#44331)
3545cde50c2 is described below
commit 3545cde50c2c5739ad5f7a6252b173effe1a085d
Author: Jens Scheffler <[email protected]>
AuthorDate: Mon Nov 25 00:25:12 2024 +0100
Bugfix/caplog flaky test in extra operator link test (#44331)
* Fix Flaky test that uses CapLog to test Serialization
* Fix Flaky test that uses CapLog to test Serialization
---
tests/serialization/test_dag_serialization.py | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/tests/serialization/test_dag_serialization.py
b/tests/serialization/test_dag_serialization.py
index 2cd65462ed7..69bd5259d7e 100644
--- a/tests/serialization/test_dag_serialization.py
+++ b/tests/serialization/test_dag_serialization.py
@@ -1067,10 +1067,13 @@ class TestStringifiedDAGs:
assert "https://www.google.com" == link
@pytest.mark.usefixtures("clear_all_logger_handlers")
- def
test_extra_operator_links_logs_error_for_non_registered_extra_links(self,
caplog):
+ def
test_extra_operator_links_logs_error_for_non_registered_extra_links(self):
"""
Assert OperatorLinks not registered via Plugins and if it is not an
inbuilt Operator Link,
- it can still deserialize the DAG (does not error) but just logs an
error
+ it can still deserialize the DAG (does not error) but just logs an
error.
+
+ We test NOT using caplog as this is flaky, we check that the task
after deserialize
+ is missing the extra links.
"""
class TaskStateLink(BaseOperatorLink):
@@ -1094,13 +1097,8 @@ class TestStringifiedDAGs:
serialized_dag = SerializedDAG.to_dict(dag)
- with caplog.at_level("ERROR",
logger="airflow.serialization.serialized_objects"):
- SerializedDAG.from_dict(serialized_dag)
-
- expected_err_msg = (
- "Operator Link class
'tests.serialization.test_dag_serialization.TaskStateLink' not registered"
- )
- assert expected_err_msg in caplog.text
+ sdag = SerializedDAG.from_dict(serialized_dag)
+ assert sdag.task_dict["blah"].operator_extra_links == []
class ClassWithCustomAttributes:
"""