-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Description
Apache Airflow version
main (development)
If "Other Airflow 2/3 version" selected, which one?
No response
What happened?
While improving code linting rules I noticed that the test
test_async_write_logs_should_execute_successfully() in providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_pod.py is not correctly implemented.
It is checking logs but mock is either not catching the right log calls or the mocked od instance is not in a state that logs are read at all.
Both True/False paramerized calls are not working:
- The call checking for log messages asserts a string only w/o checking the real logs grabbed from pod.
- The check w/o fetching logs checks a fixture not being called which is mocking the wrong function which anyway will never be called.
Added a inverted test for a call for the True case which now shows it is failing and marked the test as XFail in #57516
The broken test has been introduced in https://github.com/apache/airflow/pull/29017/files#diff-9eab8bfed52232ef1125033c59024d9ed878b6504b830ba633aa2ad7d1f60151R1342
FYI @VladaZakharova
What you think should happen instead?
The logs should be properly checked if possible (unsure whether logs are actually gabbed in deferred more, re-entry?)
How to reproduce
Enter a shell with breeze and call
pytest providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_pod.py
If the @pytest.mark.xfail is removed as decorator the test should show a failure trace.
Operating System
Linux, but unrelevant for the issue.
Versions of Apache Airflow Providers
No response
Deployment
Other
Deployment details
No response
Anything else?
No response
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct