From d81a7870d9ea47c5dea763f59fa503beb6601db4 Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Sat, 25 Oct 2025 22:47:14 +0200 Subject: [PATCH] [v3-1-test] Disable some integration tests for ARM (#57259) Some of the integration tests should not be run for ARM because they do not have multi-platform images. This PR adds the list of those tests that should be removed from ARM runs. (cherry picked from commit d75e91340d38df76018285d62ab3c1d648070853) Co-authored-by: Jarek Potiuk --- .../src/airflow_breeze/global_constants.py | 8 + .../airflow_breeze/utils/selective_checks.py | 12 +- dev/breeze/tests/test_selective_checks.py | 204 ++++++++++++++++++ 3 files changed, 222 insertions(+), 2 deletions(-) diff --git a/dev/breeze/src/airflow_breeze/global_constants.py b/dev/breeze/src/airflow_breeze/global_constants.py index 1f2b6e42728a5..220c252c0adb1 100644 --- a/dev/breeze/src/airflow_breeze/global_constants.py +++ b/dev/breeze/src/airflow_breeze/global_constants.py @@ -89,6 +89,14 @@ DISABLE_TESTABLE_INTEGRATIONS_FROM_CI = [ "mssql", ] +DISABLE_TESTABLE_INTEGRATIONS_FROM_ARM = [ + "kerberos", + "drill", + "tinkerpop", + "pinot", + "trino", + "ydb", +] KEYCLOAK_INTEGRATION = "keycloak" STATSD_INTEGRATION = "statsd" OTEL_INTEGRATION = "otel" diff --git a/dev/breeze/src/airflow_breeze/utils/selective_checks.py b/dev/breeze/src/airflow_breeze/utils/selective_checks.py index f880e8e8c14d8..3167c99d0e32a 100644 --- a/dev/breeze/src/airflow_breeze/utils/selective_checks.py +++ b/dev/breeze/src/airflow_breeze/utils/selective_checks.py @@ -41,6 +41,7 @@ DEFAULT_MYSQL_VERSION, DEFAULT_POSTGRES_VERSION, DEFAULT_PYTHON_MAJOR_MINOR_VERSION, + DISABLE_TESTABLE_INTEGRATIONS_FROM_ARM, DISABLE_TESTABLE_INTEGRATIONS_FROM_CI, HELM_VERSION, KIND_VERSION, @@ -1389,6 +1390,13 @@ def excluded_providers_as_string(self) -> str: ) # ^ sort by Python minor version return json.dumps(sorted_providers_to_exclude) + def _is_disabled_integration(self, integration: str) -> bool: + return ( + integration in DISABLE_TESTABLE_INTEGRATIONS_FROM_CI + or integration in DISABLE_TESTABLE_INTEGRATIONS_FROM_ARM + and self.runner_type in PUBLIC_ARM_RUNNERS + ) + @cached_property def testable_core_integrations(self) -> list[str]: if not self.run_unit_tests: @@ -1396,7 +1404,7 @@ def testable_core_integrations(self) -> list[str]: return [ integration for integration in TESTABLE_CORE_INTEGRATIONS - if integration not in DISABLE_TESTABLE_INTEGRATIONS_FROM_CI + if not self._is_disabled_integration(integration) ] @cached_property @@ -1406,7 +1414,7 @@ def testable_providers_integrations(self) -> list[str]: return [ integration for integration in TESTABLE_PROVIDERS_INTEGRATIONS - if integration not in DISABLE_TESTABLE_INTEGRATIONS_FROM_CI + if not self._is_disabled_integration(integration) ] @cached_property diff --git a/dev/breeze/tests/test_selective_checks.py b/dev/breeze/tests/test_selective_checks.py index a44d2548e844a..1dd330ba80b64 100644 --- a/dev/breeze/tests/test_selective_checks.py +++ b/dev/breeze/tests/test_selective_checks.py @@ -2525,3 +2525,207 @@ def test_runner_type_schedule(mock_get): result = selective_checks.runner_type assert result == '["ubuntu-22.04-arm"]' + + +@pytest.mark.parametrize( + "integration, runner_type, expected_result", + [ + # Test integrations disabled for all CI environments + pytest.param( + "elasticsearch", + PUBLIC_AMD_RUNNERS, + True, + id="elasticsearch_disabled_on_amd", + ), + pytest.param( + "mssql", + PUBLIC_AMD_RUNNERS, + True, + id="mssql_disabled_on_amd", + ), + pytest.param( + "localstack", + '["ubuntu-22.04-arm"]', + True, + id="localstack_disabled_on_arm", + ), + # Test integrations disabled only for ARM runners + pytest.param( + "kerberos", + '["ubuntu-22.04-arm"]', + True, + id="kerberos_disabled_on_arm", + ), + pytest.param( + "drill", + '["ubuntu-22.04-arm"]', + True, + id="drill_disabled_on_arm", + ), + pytest.param( + "tinkerpop", + '["ubuntu-22.04-arm"]', + True, + id="tinkerpop_disabled_on_arm", + ), + pytest.param( + "pinot", + '["ubuntu-22.04-arm"]', + True, + id="pinot_disabled_on_arm", + ), + pytest.param( + "trino", + '["ubuntu-22.04-arm"]', + True, + id="trino_disabled_on_arm", + ), + pytest.param( + "ydb", + '["ubuntu-22.04-arm"]', + True, + id="ydb_disabled_on_arm", + ), + # Test integrations that are NOT disabled on AMD runners + pytest.param( + "kerberos", + PUBLIC_AMD_RUNNERS, + False, + id="kerberos_enabled_on_amd", + ), + pytest.param( + "drill", + PUBLIC_AMD_RUNNERS, + False, + id="drill_enabled_on_amd", + ), + pytest.param( + "tinkerpop", + PUBLIC_AMD_RUNNERS, + False, + id="tinkerpop_enabled_on_amd", + ), + # Test an integration that is not in any disabled list + pytest.param( + "postgres", + PUBLIC_AMD_RUNNERS, + False, + id="postgres_enabled_on_amd", + ), + pytest.param( + "postgres", + '["ubuntu-22.04-arm"]', + False, + id="postgres_enabled_on_arm", + ), + pytest.param( + "redis", + PUBLIC_AMD_RUNNERS, + False, + id="redis_enabled_on_amd", + ), + pytest.param( + "redis", + '["ubuntu-22.04-arm"]', + False, + id="redis_enabled_on_arm", + ), + ], +) +def test_is_disabled_integration(integration: str, runner_type: str, expected_result: bool): + """Test that _is_disabled_integration correctly identifies disabled integrations.""" + selective_checks = SelectiveChecks( + files=(), + github_event=GithubEvents.PULL_REQUEST, + github_repository="apache/airflow", + github_context_dict={}, + ) + + # Mock the runner_type property + with patch.object( + SelectiveChecks, "runner_type", new_callable=lambda: property(lambda self: runner_type) + ): + result = selective_checks._is_disabled_integration(integration) + assert result == expected_result + + +def test_testable_core_integrations_excludes_disabled(): + """Test that testable_core_integrations excludes disabled integrations.""" + with patch( + "airflow_breeze.utils.selective_checks.TESTABLE_CORE_INTEGRATIONS", + ["postgres", "elasticsearch", "kerberos"], + ): + # Test with AMD runner - should exclude elasticsearch (disabled for all CI) + selective_checks_amd = SelectiveChecks( + files=("airflow-core/tests/test_example.py",), + commit_ref=NEUTRAL_COMMIT, + github_event=GithubEvents.PULL_REQUEST, + ) + with patch.object( + SelectiveChecks, "runner_type", new_callable=lambda: property(lambda self: PUBLIC_AMD_RUNNERS) + ): + result = selective_checks_amd.testable_core_integrations + assert "postgres" in result + assert "kerberos" in result + assert "elasticsearch" not in result + + +def test_testable_core_integrations_excludes_arm_disabled_on_arm(): + """Test that testable_core_integrations excludes ARM-disabled integrations on ARM runners.""" + with patch( + "airflow_breeze.utils.selective_checks.TESTABLE_CORE_INTEGRATIONS", ["postgres", "kerberos", "drill"] + ): + selective_checks_arm = SelectiveChecks( + files=("airflow-core/tests/test_example.py",), + commit_ref=NEUTRAL_COMMIT, + github_event=GithubEvents.SCHEDULE, + github_context_dict={"ref_name": "main"}, + ) + with patch.object( + SelectiveChecks, "runner_type", new_callable=lambda: property(lambda self: '["ubuntu-22.04-arm"]') + ): + result = selective_checks_arm.testable_core_integrations + assert "postgres" in result + assert "kerberos" not in result + assert "drill" not in result + + +def test_testable_providers_integrations_excludes_disabled(): + """Test that testable_providers_integrations excludes disabled integrations.""" + with patch( + "airflow_breeze.utils.selective_checks.TESTABLE_PROVIDERS_INTEGRATIONS", + ["postgres", "mssql", "trino"], + ): + # Test with AMD runner - should exclude mssql (disabled for all CI) + selective_checks_amd = SelectiveChecks( + files=("providers/tests/test_example.py",), + commit_ref=NEUTRAL_COMMIT, + github_event=GithubEvents.PULL_REQUEST, + ) + with patch.object( + SelectiveChecks, "runner_type", new_callable=lambda: property(lambda self: PUBLIC_AMD_RUNNERS) + ): + result = selective_checks_amd.testable_providers_integrations + assert "postgres" in result + assert "trino" in result + assert "mssql" not in result + + +def test_testable_providers_integrations_excludes_arm_disabled_on_arm(): + """Test that testable_providers_integrations excludes ARM-disabled integrations on ARM runners.""" + with patch( + "airflow_breeze.utils.selective_checks.TESTABLE_PROVIDERS_INTEGRATIONS", ["postgres", "trino", "ydb"] + ): + selective_checks_arm = SelectiveChecks( + files=("providers/tests/test_example.py",), + commit_ref=NEUTRAL_COMMIT, + github_event=GithubEvents.SCHEDULE, + github_context_dict={"ref_name": "main"}, + ) + with patch.object( + SelectiveChecks, "runner_type", new_callable=lambda: property(lambda self: '["ubuntu-22.04-arm"]') + ): + result = selective_checks_arm.testable_providers_integrations + assert "postgres" in result + assert "trino" not in result + assert "ydb" not in result