Skip to content

Mock the simple auth manager in permission tests and guard against the base-class patch - #75138

Merged
potiuk merged 2 commits into
apache:mainfrom
potiuk:fix-dependencies-test-mock
Oct 19, 2026
Merged

potiuk merged 2 commits into
apache:mainfrom
potiuk:fix-dependencies-test-mock

Conversation

@potiuk

@potiuk potiuk commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Five asset permission tests in routes/ui/test_dependencies.py, added in #73008, fail on main: the unreadable assets are still returned.

Same cause as #75126: the tests patch BaseAuthManager.get_authorized_assets, but since #72934 SimpleAuthManager (the auth manager the API test client uses) overrides that method, so the patch never takes effect and every asset stays readable. The production filter is fine; this patches SimpleAuthManager.get_authorized_assets, as the other asset permission tests do.

routes/ui/test_dependencies.py: 43 passed (previously 5 failed on main).

It also adds a check-auth-manager-mock-targets prek hook, since this is the second PR today (after #75126) to patch a BaseAuthManager method that SimpleAuthManager overrides. The hook reads which public methods SimpleAuthManager overrides, so it follows the code as more are added, and rejects API tests (airflow-core/tests/unit/api_fastapi/, excluding the simple auth manager's own tests) that patch one of them on BaseAuthManager, naming the SimpleAuthManager target to use instead. On the main version of test_dependencies.py it flags all 6 patches; on this branch it passes.


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

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

SimpleAuthManager overrides get_authorized_assets since apache#72934, so patching the BaseAuthManager method left the real one in place, every asset stayed readable, and the tests added in apache#73008 failed on main.

Generated-by: Claude Opus 5
@boring-cyborg boring-cyborg Bot added the area:API Airflow's REST/HTTP API label Oct 19, 2026
@potiuk potiuk added the backport-to-v3-4-test Backport to v3-4-test label Oct 19, 2026
@potiuk potiuk added this to the Airflow 3.4.0 milestone Oct 19, 2026
Twice in one day a permission test patched BaseAuthManager.get_authorized_assets, which SimpleAuthManager overrides, so the mock never applied and main broke after merge. The hook reads which methods SimpleAuthManager overrides, so it keeps up when more are added.

Generated-by: Claude Opus 5
@potiuk potiuk changed the title Mock the simple auth manager in the dependencies graph permission tests Mock the simple auth manager in permission tests and guard against the base-class patch Oct 19, 2026
@potiuk
potiuk merged commit ac0c20c into apache:main Oct 19, 2026
62 checks passed
@potiuk
potiuk deleted the fix-dependencies-test-mock branch October 19, 2026 20:30
@github-actions

Copy link
Copy Markdown
Contributor

Backport failed to create: v3-4-test. View the failure log Run details

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
❌ v3-4-test Commit Link

You can attempt to backport this manually by running:

cherry_picker ac0c20c v3-4-test

This should apply the commit to the v3-4-test branch and leave the commit in conflict state marking
the files that need manual conflict resolution.

After you have resolved the conflicts, you can continue the backport process by running:

cherry_picker --continue

If you don't have cherry-picker installed, see the installation guide.

potiuk added a commit that referenced this pull request Oct 19, 2026
…d against the base-class patch (#75138) (#75140)

Only the check-auth-manager-mock-targets prek hook applies here: the dependencies graph permission tests from #73008 are not on v3-4-test, and the upstream asset events test from #72924 already patches SimpleAuthManager on this branch.

(cherry picked from commit ac0c20c)
Generated-by: Claude Opus 5
vatsrahul1001 pushed a commit that referenced this pull request Oct 20, 2026
…d against the base-class patch (#75138) (#75140)

Only the check-auth-manager-mock-targets prek hook applies here: the dependencies graph permission tests from #73008 are not on v3-4-test, and the upstream asset events test from #72924 already patches SimpleAuthManager on this branch.

(cherry picked from commit ac0c20c)
Generated-by: Claude Opus 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API backport-to-v3-4-test Backport to v3-4-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants