Skip to content

Commit

Permalink
Add option to skip selected providers during tests
Browse files Browse the repository at this point in the history
This will be helpful when we add Airflow 2.8 and 2.7 to compatiblity
tests for providers.
  • Loading branch information
potiuk committed May 10, 2024
1 parent a2c1bcb commit 385004e
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-providers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ on: # yamllint disable-line rule:truthy
providers-compatibility-checks:
description: >
JSON-formatted array of providers compatibility checks in the form of array of dicts
(airflow-version, python-versions, remove-providers)
(airflow-version, python-versions, remove-providers, run-tests)
required: true
type: string
skip-provider-tests:
Expand Down
30 changes: 21 additions & 9 deletions dev/breeze/doc/images/output_testing_db-tests.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion dev/breeze/doc/images/output_testing_db-tests.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c020103d6f3563f684507a5db193c171
31bee62efc24fa61aa868a0643e0db6b
30 changes: 21 additions & 9 deletions dev/breeze/doc/images/output_testing_non-db-tests.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion dev/breeze/doc/images/output_testing_non-db-tests.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
99ab5855d866092bb8039b36c898a5ff
543f9814b475e511749fdebf29d16298
30 changes: 21 additions & 9 deletions dev/breeze/doc/images/output_testing_tests.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion dev/breeze/doc/images/output_testing_tests.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fe53411b168993bb4e44939575e9c9dd
3c3217a7eceaa77718af4876622e1b0f
17 changes: 17 additions & 0 deletions dev/breeze/src/airflow_breeze/commands/testing_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,13 @@ def _verify_parallelism_parameters(
is_flag=True,
envvar="SKIP_PROVIDER_TESTS",
)
option_skip_providers = click.option(
"--skip-providers",
help="Coma separated list of providers to skip when running tests",
type=str,
default="",
envvar="SKIP_PROVIDERS",
)
option_test_timeout = click.option(
"--test-timeout",
help="Test timeout in seconds. Set the pytest setup, execution and teardown timeouts to this value",
Expand Down Expand Up @@ -512,6 +519,7 @@ def _verify_parallelism_parameters(
@option_skip_db_tests
@option_skip_docker_compose_down
@option_skip_provider_tests
@option_skip_providers
@option_test_timeout
@option_test_type
@option_upgrade_boto
Expand Down Expand Up @@ -562,6 +570,7 @@ def command_for_tests(**kwargs):
@option_skip_cleanup
@option_skip_docker_compose_down
@option_skip_provider_tests
@option_skip_providers
@option_test_timeout
@option_upgrade_boto
@option_use_airflow_version
Expand Down Expand Up @@ -617,6 +626,7 @@ def command_for_db_tests(**kwargs):
@option_skip_cleanup
@option_skip_docker_compose_down
@option_skip_provider_tests
@option_skip_providers
@option_test_timeout
@option_upgrade_boto
@option_use_airflow_version
Expand Down Expand Up @@ -672,6 +682,7 @@ def _run_test_command(
skip_db_tests: bool,
skip_docker_compose_down: bool,
skip_provider_tests: bool,
skip_providers: str,
test_timeout: int,
test_type: str,
upgrade_boto: bool,
Expand Down Expand Up @@ -735,6 +746,12 @@ def _run_test_command(
# https://docs.pytest.org/en/stable/reference/exit-codes.html
# https://github.com/apache/airflow/pull/38402#issuecomment-2014938950
extra_pytest_args = (*extra_pytest_args, "--suppress-no-test-exit-code")
if skip_providers:
ignored_path_list = [
f"--ignore=tests/providers/{provider_id.replace('.','/')}"
for provider_id in skip_providers.split(",")
]
extra_pytest_args = (*extra_pytest_args, *ignored_path_list)
if run_in_parallel:
if test_type != "Default":
get_console().print(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
"--use-packages-from-dist",
"--mount-sources",
"--skip-docker-compose-down",
"--skip-providers",
],
},
],
Expand Down Expand Up @@ -155,6 +156,7 @@
"--use-packages-from-dist",
"--mount-sources",
"--skip-docker-compose-down",
"--skip-providers",
],
},
],
Expand Down Expand Up @@ -219,6 +221,7 @@
"--use-packages-from-dist",
"--mount-sources",
"--skip-docker-compose-down",
"--skip-providers",
],
},
],
Expand Down

0 comments on commit 385004e

Please sign in to comment.