Skip to content
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
8 changes: 8 additions & 0 deletions dev/breeze/src/airflow_breeze/global_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 10 additions & 2 deletions dev/breeze/src/airflow_breeze/utils/selective_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -1389,14 +1390,21 @@ 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:
return []
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
Expand All @@ -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
Expand Down
204 changes: 204 additions & 0 deletions dev/breeze/tests/test_selective_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading