Skip to content

KubernetesPodOperator Test test_async_write_logs_should_execute_successfully is not working #57515

Closed
hwang-cadent/airflow
#1

Description

@jscheffl

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

Activity

  1. added theissue type on Oct 29, 2025
  2. added a commit that references this issue on Nov 13, 2025
    3e55abd
  3. added a commit that references this issue on Nov 15, 2025
    fb029cf
  4. added a commit that references this issue on Nov 20, 2025
    67d5eeb
  5. added 2 commits that reference this issue on Nov 22, 2025
    9fdb2a4
    dc1a4b9
  6. added a commit that references this issue on Dec 5, 2025
    fb169a4
  7. added a commit that references this issue on Dec 6, 2025
    2cdd453
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions