amoghrajesh commented on code in PR #76575: URL: https://github.com/apache/airflow/pull/76575#discussion_r4509687894
########## dev/registry/tests/test_fill_durable_versions.py: ########## @@ -0,0 +1,204 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +"""Unit tests for dev/registry/fill_durable_versions.py.""" + +from __future__ import annotations + +import json +from unittest import mock + +import pytest +from fill_durable_versions import ( + build_source_path, + durable_group, + find_first_releases, + get_released_tags, + main, +) + +POD_PATH = "providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/pod.py" +POD_CLASS = "airflow.providers.cncf.kubernetes.operators.pod.KubernetesPodOperator" + + [email protected](autouse=True) +def clear_tag_cache(): + get_released_tags.cache_clear() + yield + get_released_tags.cache_clear() + + +def fake_git(tags=(), matches=()): + """Stand in for run_git: `tag --list` returns tags, `grep` returns tag:path lines.""" + + def run(*args): + if args[0] == "tag": + return list(tags) + if args[0] == "grep": Review Comment: `run_git` now takes `allowed_returncodes`, default `(0,)`. Anything else raises `GitCommandError` with git's stderr. `git grep` passes `(0, 1)`, since 1 is a real no-match. `__main__` prints the error and exits 1, so a broken checkout no longer looks tagless. Three tests added for it too ########## dev/registry/tests/test_fill_durable_versions.py: ########## @@ -0,0 +1,204 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +"""Unit tests for dev/registry/fill_durable_versions.py.""" + +from __future__ import annotations + +import json +from unittest import mock + +import pytest +from fill_durable_versions import ( + build_source_path, + durable_group, + find_first_releases, + get_released_tags, + main, +) + +POD_PATH = "providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/pod.py" +POD_CLASS = "airflow.providers.cncf.kubernetes.operators.pod.KubernetesPodOperator" + + [email protected](autouse=True) +def clear_tag_cache(): + get_released_tags.cache_clear() + yield + get_released_tags.cache_clear() + + +def fake_git(tags=(), matches=()): + """Stand in for run_git: `tag --list` returns tags, `grep` returns tag:path lines.""" + + def run(*args): + if args[0] == "tag": + return list(tags) + if args[0] == "grep": Review Comment: [comments from wei](https://github.com/apache/airflow/pull/76575/commits/15eab726413fb47ca6a180a77bca432d92517b6b) ########## dev/registry/tests/test_fill_durable_versions.py: ########## @@ -0,0 +1,204 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +"""Unit tests for dev/registry/fill_durable_versions.py.""" Review Comment: [comments from wei](https://github.com/apache/airflow/pull/76575/commits/15eab726413fb47ca6a180a77bca432d92517b6b) ########## dev/breeze/src/airflow_breeze/commands/registry_commands.py: ########## @@ -145,7 +145,28 @@ def extract_data(python: str, provider: str | None, allow_unreleased: bool): bring_compose_project_down(preserve_volumes=False, shell_params=shell_params) remove_docker_networks([f"{unique_project_name}_default"]) fix_ownership_using_docker() - sys.exit(result.returncode) + if result.returncode: + sys.exit(result.returncode) + + # Dating a durable module needs the providers-* tags, so it runs here rather than beside + # the module extraction in the container. + with ci_group("Dating durable modules"): + versions_result = run_command( + [ + "uv", + "run", + "--project", + str(DEV_REGISTRY_DIR), + "python", + str(DEV_REGISTRY_DIR / "fill_durable_versions.py"), + "--modules", + str(DEV_REGISTRY_DIR / "output" / "modules.json"), Review Comment: [comments from wei](https://github.com/apache/airflow/pull/76575/commits/15eab726413fb47ca6a180a77bca432d92517b6b) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
