Skip to content

Commit eb05869

Browse files
authored
Move Google provider to new provider structure (#46344)
* init run on google and fix mypy issues * fix tests * replace providers.tests.system.google with providers.google.tests.google * add example dag's path for new structure * fix paths in docs * fix import path for failing test in test_dataprep_system * fix DEFAULT_GCP_SYSTEM_TEST_PROJECT_ID import * update google test paths * replace providers/tests/google with providers/google/tests/provider_tests/google * remove test_get_package_extras_for_old_providers * fix test_folders_for_parallel_test_types test * fix test_pytest_args_for_regular_test_types * replace providers/tests/system/google/ with providers/google/tests/system/google * update example_dirs in example_not_excluded_dags * fix glob path in ExampleCoverageTest.example_paths * fix providers_prefix * fix serialization tests * fix * add filterwarnings to test_bigquery and test_kubernetes_engine modules * add explicit info logging to test_dataflow.py * add explicit info logging to test_datafusion.py * add explicit info logging to test_datafusion.py * add explicit info logging to failing caplog tests * enable info logging * add tmp.tar.gz
1 parent 0eb01eb commit eb05869

File tree

1,064 files changed

+4476
-2615
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,064 files changed

+4476
-2615
lines changed

.github/boring-cyborg.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,7 @@ labelPRBasedOnFilePath:
171171
- providers/github/**
172172

173173
provider:google:
174-
- providers/src/airflow/providers/google/**/*
175-
- docs/apache-airflow-providers-google/**/*
176-
- providers/tests/google/**/*
177-
- providers/tests/system/google/**/*
174+
- providers/google/**
178175

179176
provider:grpc:
180177
- providers/grpc/**

.pre-commit-config.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ repos:
312312
exclude: material-icons\.css$|^images/.*$|^RELEASE_NOTES\.txt$|^.*package-lock\.json$|^.*/kinglear\.txt$|^.*pnpm-lock\.yaml$
313313
args:
314314
- --ignore-words=docs/spelling_wordlist.txt
315-
- --skip=providers/src/airflow/providers/*/*.rst,airflow/www/*.log,docs/*/commits.rst,providers/*/docs/commits.rst,providers/*/*/docs/commits.rst,docs/apache-airflow/tutorial/pipeline_example.csv,*.min.js,*.lock,INTHEWILD.md
315+
- --skip=providers/src/airflow/providers/*/*.rst,providers/*/docs/changelog.rst,airflow/www/*.log,docs/*/commits.rst,providers/*/docs/commits.rst,providers/*/*/docs/commits.rst,docs/apache-airflow/tutorial/pipeline_example.csv,*.min.js,*.lock,INTHEWILD.md
316316
- --exclude-file=.codespellignorelines
317317
- repo: https://github.com/woodruffw/zizmor-pre-commit
318318
rev: v1.0.0
@@ -636,10 +636,10 @@ repos:
636636
^providers/exasol/src/airflow/providers/exasol/hooks/exasol.py$|
637637
^providers/fab/src/airflow/providers/fab/auth_manager/security_manager/|
638638
^providers/fab/src/airflow/providers/fab/www/static/css/bootstrap-theme.css$|
639-
^providers/src/airflow/providers/google/cloud/hooks/bigquery.py$|
640-
^providers/src/airflow/providers/google/cloud/operators/cloud_build.py$|
641-
^providers/src/airflow/providers/google/cloud/operators/dataproc.py$|
642-
^providers/src/airflow/providers/google/cloud/operators/mlengine.py$|
639+
^providers/google/src/airflow/providers/google/cloud/hooks/bigquery.py$|
640+
^providers/google/src/airflow/providers/google/cloud/operators/cloud_build.py$|
641+
^providers/google/src/airflow/providers/google/cloud/operators/dataproc.py$|
642+
^providers/google/src/airflow/providers/google/cloud/operators/mlengine.py$|
643643
^providers/src/airflow/providers/microsoft/azure/hooks/cosmos.py$|
644644
^providers/src/airflow/providers/microsoft/winrm/hooks/winrm.py$|
645645
^airflow/www/fab_security/manager.py$|
@@ -663,7 +663,7 @@ repos:
663663
^providers/apache/kafka/docs/connections/kafka.rst$|
664664
^providers/apache/spark/docs/decorators/pyspark.rst$|
665665
^providers/fab/docs/auth-manager/webserver-authentication.rst$|
666-
^docs/apache-airflow-providers-google/operators/cloud/kubernetes_engine.rst$|
666+
^providers/google/docs/operators/cloud/kubernetes_engine.rst$|
667667
^docs/apache-airflow-providers-microsoft-azure/connections/azure_cosmos.rst$|
668668
^docs/apache-airflow-providers-cncf-kubernetes/operators.rst$|
669669
^docs/conf.py$|

contributing-docs/testing/system_tests.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ For providers:
9090

9191
.. code-block:: bash
9292
93-
pytest --system providers/tests/system/google/cloud/bigquery/example_bigquery_queries.py
93+
pytest --system providers/google/tests/system/google/cloud/bigquery/example_bigquery_queries.py
9494
9595
9696
Running via Breeze

dev/breeze/src/airflow_breeze/utils/run_tests.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@ def get_excluded_provider_args(python_version: str) -> list[str]:
217217
"tests/dags_with_system_exit",
218218
"tests/dags_corrupted",
219219
"tests/dags",
220-
"providers/tests/system/google/cloud/dataproc/resources",
221-
"providers/tests/system/google/cloud/gcs/resources",
220+
"providers/google/tests/system/google/cloud/dataproc/resources",
221+
"providers/google/tests/system/google/cloud/gcs/resources",
222222
]
223223

224224

dev/breeze/tests/test_packages.py

-118
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@
3535
get_min_airflow_version,
3636
get_old_documentation_package_path,
3737
get_old_source_providers_package_path,
38-
get_package_extras_for_old_providers,
3938
get_pip_package_name,
40-
get_provider_details,
4139
get_provider_info_dict,
4240
get_provider_jinja_context,
4341
get_provider_requirements,
@@ -238,122 +236,6 @@ def test_get_install_requirements(provider: str, version_suffix: str, expected:
238236
assert actual.strip() == expected.strip()
239237

240238

241-
# TODO(potiuk) - remove when all providers are new-style
242-
@pytest.mark.parametrize(
243-
"version_suffix, expected",
244-
[
245-
pytest.param(
246-
"",
247-
{
248-
"amazon": ["apache-airflow-providers-amazon>=2.6.0"],
249-
"apache.beam": ["apache-airflow-providers-apache-beam", "apache-beam[gcp]"],
250-
"apache.cassandra": ["apache-airflow-providers-apache-cassandra"],
251-
"cncf.kubernetes": ["apache-airflow-providers-cncf-kubernetes>=10.1.0"],
252-
"facebook": ["apache-airflow-providers-facebook>=2.2.0"],
253-
"leveldb": ["plyvel>=1.5.1"],
254-
"microsoft.azure": ["apache-airflow-providers-microsoft-azure"],
255-
"microsoft.mssql": ["apache-airflow-providers-microsoft-mssql"],
256-
"mysql": ["apache-airflow-providers-mysql"],
257-
"openlineage": ["apache-airflow-providers-openlineage"],
258-
"oracle": ["apache-airflow-providers-oracle>=3.1.0"],
259-
"postgres": ["apache-airflow-providers-postgres"],
260-
"presto": ["apache-airflow-providers-presto"],
261-
"salesforce": ["apache-airflow-providers-salesforce"],
262-
"sftp": ["apache-airflow-providers-sftp"],
263-
"ssh": ["apache-airflow-providers-ssh"],
264-
"trino": ["apache-airflow-providers-trino"],
265-
},
266-
id="No suffix",
267-
),
268-
pytest.param(
269-
"dev0",
270-
{
271-
"amazon": ["apache-airflow-providers-amazon>=2.6.0.dev0"],
272-
"apache.beam": ["apache-airflow-providers-apache-beam", "apache-beam[gcp]"],
273-
"apache.cassandra": ["apache-airflow-providers-apache-cassandra"],
274-
"cncf.kubernetes": ["apache-airflow-providers-cncf-kubernetes>=10.1.0.dev0"],
275-
"facebook": ["apache-airflow-providers-facebook>=2.2.0.dev0"],
276-
"leveldb": ["plyvel>=1.5.1"],
277-
"microsoft.azure": ["apache-airflow-providers-microsoft-azure"],
278-
"microsoft.mssql": ["apache-airflow-providers-microsoft-mssql"],
279-
"mysql": ["apache-airflow-providers-mysql"],
280-
"openlineage": ["apache-airflow-providers-openlineage"],
281-
"oracle": ["apache-airflow-providers-oracle>=3.1.0.dev0"],
282-
"postgres": ["apache-airflow-providers-postgres"],
283-
"presto": ["apache-airflow-providers-presto"],
284-
"salesforce": ["apache-airflow-providers-salesforce"],
285-
"sftp": ["apache-airflow-providers-sftp"],
286-
"ssh": ["apache-airflow-providers-ssh"],
287-
"trino": ["apache-airflow-providers-trino"],
288-
},
289-
id="With dev0 suffix",
290-
),
291-
pytest.param(
292-
"beta0",
293-
{
294-
"amazon": ["apache-airflow-providers-amazon>=2.6.0b0"],
295-
"apache.beam": ["apache-airflow-providers-apache-beam", "apache-beam[gcp]"],
296-
"apache.cassandra": ["apache-airflow-providers-apache-cassandra"],
297-
"cncf.kubernetes": ["apache-airflow-providers-cncf-kubernetes>=10.1.0b0"],
298-
"facebook": ["apache-airflow-providers-facebook>=2.2.0b0"],
299-
"leveldb": ["plyvel>=1.5.1"],
300-
"microsoft.azure": ["apache-airflow-providers-microsoft-azure"],
301-
"microsoft.mssql": ["apache-airflow-providers-microsoft-mssql"],
302-
"mysql": ["apache-airflow-providers-mysql"],
303-
"openlineage": ["apache-airflow-providers-openlineage"],
304-
"oracle": ["apache-airflow-providers-oracle>=3.1.0b0"],
305-
"postgres": ["apache-airflow-providers-postgres"],
306-
"presto": ["apache-airflow-providers-presto"],
307-
"salesforce": ["apache-airflow-providers-salesforce"],
308-
"sftp": ["apache-airflow-providers-sftp"],
309-
"ssh": ["apache-airflow-providers-ssh"],
310-
"trino": ["apache-airflow-providers-trino"],
311-
},
312-
id="With beta0 suffix normalized automatically to b0 (PEP 440)",
313-
),
314-
],
315-
)
316-
def test_get_package_extras_for_old_providers(version_suffix: str, expected: dict[str, list[str]]):
317-
actual = get_package_extras_for_old_providers("google", version_suffix=version_suffix)
318-
expected_as_list: list[str] = []
319-
for package, extras in expected.items():
320-
expected_as_list.append(f'"{package}" = [')
321-
for extra in extras:
322-
expected_as_list.append(f' "{extra}",')
323-
expected_as_list.append("]")
324-
expected_as_str = "\n".join(expected_as_list)
325-
assert actual == expected_as_str
326-
327-
328-
# TODO(potiuk) - remove when all providers are new-style
329-
def test_get_new_provider_details():
330-
provider_details = get_provider_details("airbyte")
331-
assert provider_details.provider_id == "airbyte"
332-
assert provider_details.full_package_name == "airflow.providers.airbyte"
333-
assert provider_details.pypi_package_name == "apache-airflow-providers-airbyte"
334-
assert provider_details.root_provider_path == AIRFLOW_SOURCES_ROOT.joinpath(
335-
"providers",
336-
"airbyte",
337-
)
338-
assert provider_details.base_provider_package_path == AIRFLOW_SOURCES_ROOT.joinpath(
339-
"providers",
340-
"airbyte",
341-
"src",
342-
"airflow",
343-
"providers",
344-
"airbyte",
345-
)
346-
assert provider_details.documentation_provider_package_path == AIRFLOW_SOURCES_ROOT.joinpath(
347-
"providers", "airbyte", "docs"
348-
)
349-
assert "Airbyte" in provider_details.provider_description
350-
assert len(provider_details.versions) > 11
351-
assert provider_details.excluded_python_versions == []
352-
assert provider_details.plugins == []
353-
assert provider_details.changelog_path == provider_details.root_provider_path / "docs" / "changelog.rst"
354-
assert not provider_details.removed
355-
356-
357239
@pytest.mark.parametrize(
358240
"provider_id, pip_package_name",
359241
[

dev/breeze/tests/test_pytest_args_for_test_types.py

+24-6
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,23 @@ def _all_new_providers() -> list[str]:
9595
(
9696
GroupOfTests.PROVIDERS,
9797
"Providers[amazon,google,apache.hive]",
98-
["providers/tests/amazon", "providers/tests/google", "providers/apache/hive/tests"],
98+
[
99+
"providers/tests/amazon",
100+
"providers/google/tests",
101+
"providers/apache/hive/tests",
102+
],
99103
),
100104
(
101105
GroupOfTests.PROVIDERS,
102106
"Providers[-amazon,google,microsoft.azure]",
103107
[
104-
*[f"providers/{provider}/tests" for provider in _all_new_providers()],
108+
*[
109+
f"providers/{provider}/tests"
110+
for provider in _all_new_providers()
111+
if provider not in ["amazon", "google", "microsoft/azure"]
112+
],
105113
"providers/tests",
106114
"--ignore=providers/tests/amazon",
107-
"--ignore=providers/tests/google",
108115
"--ignore=providers/tests/microsoft/azure",
109116
],
110117
),
@@ -244,23 +251,34 @@ def test_pytest_args_for_missing_provider():
244251
"Providers[amazon] Providers[google]",
245252
[
246253
"providers/tests/amazon",
247-
"providers/tests/google",
254+
"providers/google/tests",
248255
],
249256
),
250257
(
251258
GroupOfTests.PROVIDERS,
252259
"Providers[-amazon,google]",
253260
[
254-
*[f"providers/{provider}/tests" for provider in _all_new_providers()],
261+
*[
262+
f"providers/{provider}/tests"
263+
for provider in _all_new_providers()
264+
if provider not in ["amazon", "google"]
265+
],
255266
"providers/tests",
256267
],
257268
),
258269
(
259270
GroupOfTests.PROVIDERS,
260271
"Providers[-amazon,google] Providers[amazon] Providers[google]",
261272
[
262-
*[f"providers/{provider}/tests" for provider in _all_new_providers()],
273+
*[
274+
f"providers/{provider}/tests"
275+
for provider in _all_new_providers()
276+
if provider not in ["amazon", "google"]
277+
],
263278
"providers/tests",
279+
*[
280+
"providers/google/tests"
281+
], # Once amazon is migrated to the new structure, amazon needs to be added to the list here.
264282
],
265283
),
266284
(

dev/breeze/tests/test_selective_checks.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,7 @@ def test_expected_output_full_tests_needed(
13841384
pytest.param(
13851385
(
13861386
"chart/aaaa.txt",
1387-
"providers/tests/google/file.py",
1387+
"providers/google/tests/provider_tests/google/file.py",
13881388
),
13891389
{
13901390
"all-python-versions": "['3.9']",
@@ -1411,7 +1411,7 @@ def test_expected_output_full_tests_needed(
14111411
(
14121412
"airflow/cli/test.py",
14131413
"chart/aaaa.txt",
1414-
"providers/tests/google/file.py",
1414+
"providers/google/tests/provider_tests/google/file.py",
14151415
),
14161416
{
14171417
"all-python-versions": "['3.9']",
@@ -1436,7 +1436,7 @@ def test_expected_output_full_tests_needed(
14361436
pytest.param(
14371437
(
14381438
"airflow/file.py",
1439-
"providers/tests/google/file.py",
1439+
"providers/google/tests/provider_tests/google/file.py",
14401440
),
14411441
{
14421442
"all-python-versions": "['3.9']",
@@ -1614,7 +1614,7 @@ def test_expected_output_push(
16141614
(
16151615
"airflow/cli/test.py",
16161616
"chart/aaaa.txt",
1617-
"providers/tests/google/file.py",
1617+
"providers/google/tests/provider_tests/google/file.py",
16181618
),
16191619
{
16201620
"selected-providers-list-as-string": "amazon apache.beam apache.cassandra "

docs/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ apache-airflow-providers-fab
3434
apache-airflow-providers-facebook
3535
apache-airflow-providers-ftp
3636
apache-airflow-providers-github
37+
apache-airflow-providers-google
3738
apache-airflow-providers-grpc
3839
apache-airflow-providers-http
3940
apache-airflow-providers-jdbc

docs/apache-airflow-providers-google/changelog.rst

-25
This file was deleted.

0 commit comments

Comments
 (0)