uranusjr commented on code in PR #75184: URL: https://github.com/apache/airflow/pull/75184#discussion_r4439567142
########## scripts/tests/ci/prek/test_sync_java_sdk_supervisor_schema.py: ########## @@ -0,0 +1,132 @@ +# 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. +from __future__ import annotations + +import json + +import pytest +import sync_java_sdk_supervisor_schema as syncer + +VERSION = "2027-02-28" + + +def write_schema(path, api_version=VERSION, **extra): + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text(json.dumps({"api_version": api_version, **extra})) + return path + + [email protected] +def repo(tmp_path): + """A checkout whose declared version, owned schema and vendored copy are all in step.""" + (tmp_path / syncer.GRADLE_PROPERTIES).parent.mkdir(parents=True, exist_ok=True) + (tmp_path / syncer.GRADLE_PROPERTIES).write_text( + f"org.gradle.caching=true\nairflowSupervisorSchemaVersion={VERSION}\n" + ) + write_schema(tmp_path / syncer.SOURCE_SCHEMA, title="supervisor") + write_schema(tmp_path / syncer.VENDORED_SCHEMA, title="supervisor") + return tmp_path + + +def test_the_copy_is_vendored_inside_the_java_sdk(): + # A copy outside java-sdk/ would leave the Gradle build reaching across the monorepo, + # which is the coupling vendoring removes. + assert str(syncer.VENDORED_SCHEMA).startswith("java-sdk/") + assert not str(syncer.SOURCE_SCHEMA).startswith("java-sdk/") Review Comment: Is this meaningful? Those are just constants. -- 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]
