Skip to content

test_listener_logs_failed_serialization is flaky  #42020

@potiuk

Description

@potiuk

Body

The test_listener_logs_failed_serialization is flaky - likely due to a race condition. This should be improve.

Example failure:

https://github.com/apache/airflow/actions/runs/10714765649/job/29709338209?pr=41331#step:7:5256

=================================== FAILURES ===================================
___________________ test_listener_logs_failed_serialization ____________________

self = <MagicMock name='mock.warning' id='139678763968448'>

    def assert_called_once(self):
        """assert that the mock was called only once.
        """
        if not self.call_count == 1:
            msg = ("Expected '%s' to have been called once. Called %s times.%s"
                   % (self._mock_name or 'mock',
                      self.call_count,
                      self._calls_repr()))
>           raise AssertionError(msg)
E           AssertionError: Expected 'warning' to have been called once. Called 0 times.

/usr/local/lib/python3.8/unittest/mock.py:892: AssertionError

During handling of the above exception, another exception occurred:

    def test_listener_logs_failed_serialization():
        listener = OpenLineageListener()
        listener.log = MagicMock()
        listener.adapter = OpenLineageAdapter(
            client=OpenLineageClient(transport=ConsoleTransport(config=ConsoleConfig()))
        )
        event_time = dt.datetime.now()
    
        fut = listener.submit_callable(
            listener.adapter.dag_failed,
            dag_id="",
            run_id="",
            end_date=event_time,
            execution_date=threading.Thread(),
            dag_run_state=DagRunState.FAILED,
            task_ids=["task_id"],
            msg="",
        )
        assert fut.exception(10)
>       listener.log.warning.assert_called_once()
E       AssertionError: Expected 'warning' to have been called once. Called 0 times.

tests/providers/openlineage/plugins/test_listener.py:628: AssertionError
----------------------------- Captured stdout call -----------------------------

Committer

  • I acknowledge that I am a maintainer/committer of the Apache Airflow project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuarantineIssues that are occasionally failing and are quarantinedarea:loggingkind:metaHigh-level information important to the community

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions