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

Run unit tests with airflow installed from packages #39513

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion .github/workflows/check-providers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ 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
providers-test-types-list-as-string:
description: "List of parallel provider test types as string"
required: true
type: string
skip-provider-tests:
Expand Down Expand Up @@ -237,6 +241,9 @@ jobs:
- name: >
Install and verify all provider packages and airflow on
Airflow ${{ matrix.airflow-version }}:Python ${{ matrix.python-version }}
# We do not need to run import check if we run tests, the tests should cover all the import checks
# automatically
if: matrix.run-tests != 'true'
run: >
breeze release-management verify-provider-packages
--use-packages-from-dist
Expand All @@ -245,3 +252,17 @@ jobs:
--airflow-constraints-reference constraints-${{matrix.airflow-version}}
--providers-skip-constraints
--install-airflow-with-constraints
- name: >
Run provider unit tests on
Airflow ${{ matrix.airflow-version }}:Python ${{ matrix.python-version }}
if: matrix.run-tests == 'true'
run: >
breeze testing tests --run-in-parallel
--parallel-test-types "${{ inputs.providers-test-types-list-as-string }}"
--use-packages-from-dist
--package-format wheel
--use-airflow-version "${{ matrix.airflow-version }}"
--airflow-constraints-reference constraints-${{matrix.airflow-version}}
--install-airflow-with-constraints
--providers-skip-constraints
--skip-providers "${{ matrix.remove-providers }}"
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ jobs:
full-tests-needed: ${{ steps.selective-checks.outputs.full-tests-needed }}
parallel-test-types-list-as-string: >-
${{ steps.selective-checks.outputs.parallel-test-types-list-as-string }}
providers-test-types-list-as-string: >-
${{ steps.selective-checks.outputs.providers-test-types-list-as-string }}
include-success-outputs: ${{ steps.selective-checks.outputs.include-success-outputs }}
postgres-exclude: ${{ steps.selective-checks.outputs.postgres-exclude }}
mysql-exclude: ${{ steps.selective-checks.outputs.mysql-exclude }}
Expand Down Expand Up @@ -315,6 +317,7 @@ jobs:
providers-compatibility-checks: ${{ needs.build-info.outputs.providers-compatibility-checks }}
skip-provider-tests: ${{ needs.build-info.outputs.skip-provider-tests }}
python-versions: ${{ needs.build-info.outputs.python-versions }}
providers-test-types-list-as-string: ${{ needs.build-info.outputs.providers-test-types-list-as-string }}

tests-helm:
name: "Helm tests"
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,8 @@ function determine_airflow_to_use() {
mkdir -p "${AIRFLOW_SOURCES}"/tmp/
else
python "${IN_CONTAINER_DIR}/install_airflow_and_providers.py"
# Some packages might leave legacy typing module which causes test issues
pip uninstall -y typing || true
fi

if [[ "${USE_AIRFLOW_VERSION}" =~ ^2\.2\..*|^2\.1\..*|^2\.0\..* && "${AIRFLOW__DATABASE__SQL_ALCHEMY_CONN=}" != "" ]]; then
Expand Down
1 change: 0 additions & 1 deletion airflow/providers/openlineage/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ def is_disabled() -> bool:
option = os.getenv("OPENLINEAGE_DISABLED", "")
if _is_true(option):
return True

# Check if both 'transport' and 'config_path' are not present and also
# if legacy 'OPENLINEAGE_URL' environment variables is not set
return transport() == {} and config_path(True) == "" and os.getenv("OPENLINEAGE_URL", "") == ""
Expand Down
3 changes: 3 additions & 0 deletions airflow/providers/openlineage/plugins/openlineage.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ class OpenLineageProviderPlugin(AirflowPlugin):
if not conf.is_disabled():
macros = [lineage_job_namespace, lineage_job_name, lineage_run_id, lineage_parent_id]
listeners = [get_openlineage_listener()]
else:
macros = []
listeners = []
Loading