Skip to content

Fix Databricks async connection test on Airflow before 3.1 - #74427

Merged
potiuk merged 2 commits into
apache:mainfrom
dheerajturaga:fix-databricks-async-conn-test-compat
Oct 7, 2026
Merged

potiuk merged 2 commits into
apache:mainfrom
dheerajturaga:fix-databricks-async-conn-test-compat

Conversation

@dheerajturaga

Copy link
Copy Markdown
Member

#74406 added test_async_do_api_call_fetches_connection_asynchronously, which fails in the Compat 2.11.1 and Compat 3.0.6 provider test jobs on main and on every open PR:

TypeError: multiple values for argument 'conn_id'

The test assumed the hook always awaits aget_connection, which BaseHook only has from Airflow 3.1. Before that, get_async_connection runs get_connection in a worker thread, which is the Airflow 3.0 fix #74406 made. The test forbade any get_connection call, and its autospecced mock of the inherited classmethod receives the hook as conn_id when called on an instance, hence the TypeError.

The mock now raises the AsyncToSync error only when get_connection runs on the event loop thread, as Airflow 3.0 does, and otherwise returns the real connection. The test passes on Airflow built from main and on Airflow 3.0.6 with provider wheels built from this branch, and still fails with the AsyncToSync error if the hook's async connection lookup is removed.

related: #74406


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 5.5)

Generated-by: Claude Code (Opus 5.5) following the guidelines

The test assumed the hook always awaits aget_connection, which BaseHook
only has from Airflow 3.1. On older versions get_async_connection runs
get_connection in a worker thread, so the Compat 2.11.1 and 3.0.6
provider jobs fail on main and every open PR. Failing only when
get_connection runs on the event loop, which is what broke on Airflow
3.0, covers both paths.

@aaron-y-chen aaron-y-chen left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM!

The failing static checks job is unrelated to this PR: codespell is currently broken on main. I've opened #74430 to fix it; once that's merged, a rebase should get CI green.

@potiuk
potiuk merged commit fe4481c into apache:main Oct 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants