Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move generate_jwt_token to test_common.test_utils #47712

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jason810496
Copy link
Member

related slack discussion: https://apache-airflow.slack.com/archives/C06K9Q5G2UA/p1741769075107729

Why

Since AIP-84 | Add Auth for Dags #47433 introduces get_jwt_token with the new login flow for testing. To ensure consistency, this test utility should have a single source across clients/python/test_python_client.py, docker_tests, and kubernetes_tests.

How

  • Introduce generate_jwt_token and RefreshJwtAdapter as utility functions.
  • Rename get_jwt_token to generate_jwt_token, as suggested by @ashb.

@boring-cyborg boring-cyborg bot added area:API Airflow's REST/HTTP API area:production-image Production image improvements and fixes labels Mar 13, 2025
@jason810496 jason810496 force-pushed the refactor/make-generate-jwt-token-as-common-module branch from 518b485 to e2d468d Compare March 25, 2025 05:33
@jason810496 jason810496 added area:CI Airflow's tests and continious integration area:dev-env CI, pre-commit, pylint and other changes that do not change the behavior of the final code and removed area:dev-env CI, pre-commit, pylint and other changes that do not change the behavior of the final code labels Mar 25, 2025
@jason810496 jason810496 force-pushed the refactor/make-generate-jwt-token-as-common-module branch from e2d468d to b5e2169 Compare March 25, 2025 08:02
@jason810496 jason810496 marked this pull request as ready for review March 25, 2025 08:02
@jason810496 jason810496 force-pushed the refactor/make-generate-jwt-token-as-common-module branch 2 times, most recently from 3c72861 to b022a62 Compare March 25, 2025 11:54
@jason810496 jason810496 marked this pull request as draft March 26, 2025 08:23
Copy link
Contributor

@vincbeck vincbeck left a comment

Choose a reason for hiding this comment

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

I like this PR, I think it is a great idea. However, it will potentially conflict with #48498

@jason810496
Copy link
Member Author

I like this PR, I think it is a great idea. However, it will potentially conflict with #48498

Thanks for reminding the conflict @vincbeck !
It's not a big problems, I can rebase after #48498 being merged.

@jason810496 jason810496 force-pushed the refactor/make-generate-jwt-token-as-common-module branch from b022a62 to ca65747 Compare March 28, 2025 14:51
:return: The JWT token
"""
Retry.DEFAULT_BACKOFF_MAX = 32
retry = Retry(total=10, backoff_factor=1)
Copy link
Member

Choose a reason for hiding this comment

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

It would be good to add some status_forcelist or provide a config? the default status_forcelist is None

Copy link
Member Author

Choose a reason for hiding this comment

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

I just added 429 and common 5xx server side error as status_forcelist, thanks for the catch !

@jason810496 jason810496 force-pushed the refactor/make-generate-jwt-token-as-common-module branch from 35d6fbd to 58cd84d Compare March 29, 2025 13:26
@jason810496 jason810496 force-pushed the refactor/make-generate-jwt-token-as-common-module branch from 58cd84d to 37e712d Compare March 29, 2025 14:31
@jason810496 jason810496 added the full tests needed We need to run full set of tests for this PR to merge label Mar 29, 2025
@jason810496 jason810496 reopened this Mar 29, 2025
@vincbeck
Copy link
Contributor

#48498 is now merged

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 area:CI Airflow's tests and continious integration area:production-image Production image improvements and fixes full tests needed We need to run full set of tests for this PR to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants