Skip to content

Move helm-tests/ to chart/tests/ and merge pyproject.toml into chart's#66371

Open
potiuk wants to merge 2 commits intoapache:mainfrom
potiuk:move-helm-tests-to-chart
Open

Move helm-tests/ to chart/tests/ and merge pyproject.toml into chart's#66371
potiuk wants to merge 2 commits intoapache:mainfrom
potiuk:move-helm-tests-to-chart

Conversation

@potiuk
Copy link
Copy Markdown
Member

@potiuk potiuk commented May 4, 2026

Summary

The Helm chart Python tests previously lived as their own workspace
member at helm-tests/ with a dedicated apache-airflow-helm-tests
package. The chart sources and tests are inseparable in practice, so
this collapses them into a single chart workspace member: the test
files move under chart/tests/, and helm-tests/pyproject.toml is
merged into chart/pyproject.toml. The chart pyproject adopts the
former helm-tests pytest config, the mypy dependency-group, and the
test-only deps on apache-airflow-devel-common and
apache-airflow-providers-cncf-kubernetes.

What stays (user/CI-visible names)

Intentionally not renamed in this PR — that would have a much wider
ripple in CI/release tooling than the directory move itself:

  • breeze testing helm-tests — command name unchanged.
  • mypy-helm-tests — prek hook id unchanged (now lives in
    chart/.pre-commit-config.yaml, with the entry pointing at the new
    chart/tests folder).
  • run-helm-tests — selective-checks output / CI gate variable.
  • helm-tests.yml — CI workflow file.
  • The directory chart/tests/helm_tests/ keeps the Python package
    name helm_tests so test imports and --test-type X arguments
    don't shift.

What changed

  • Root pyproject.toml: workspace member ("helm-tests""chart"),
    [tool.uv.sources], apache-airflow-helm-chart = false constraint
    rows, ruff per-file ignores, mypy include path, dev dependency-group.
  • .github/CODEOWNERS: folded the /helm-tests/ line into the
    existing /chart/ entry (same owners, just absorbs the test path).
  • .github/dependabot.yml and dev/update_github_branch_config.py:
    /helm-tests/chart.
  • Breeze internals — global_constants.all_helm_test_packages,
    run_tests.TEST_GROUP_TO_TEST_FOLDERS[GroupOfTests.HELM],
    run_tests.find_pytest_arguments (drop the now-redundant inner
    tests/ segment), docker_command_utils mounts (the
    helm-tests mount is gone; chart/ was already mounted),
    selective_checks regexes
    (HELM_FILES, ALL_HELM_TESTS_PYTHON_FILES, ALL_SOURCE_FILES).
  • scripts/ci/docker-compose/local.yml: drop the redundant
    helm-tests bind mount.
  • scripts/ci/prek/run_mypy_full_dist_local_venv_or_breeze_in_ci.py:
    _TOP_LEVEL_ALLOWED_FOLDERS swap and a
    FOLDER_TO_PROJECT["chart/tests"] = "chart" override since
    chart/tests is not its own uv project — it lives inside the
    chart workspace member.
  • dev/ide_setup/setup_idea.py: module list.
  • Root .pre-commit-config.yaml: two test-file path exclusions.
  • Docs in contributing-docs/testing/helm_unit_tests.rst and
    dev/breeze/doc/ci/04_selective_checks.md.
  • Existing breeze unit tests in dev/breeze/tests/test_*.py updated
    to assert the new paths.
  • Regenerated uv.lock (workspace-member rename
    apache-airflow-helm-testsapache-airflow-helm-chart).

Follow-up: tighten chart packaging + add a CI guard (commit 910a4762e6)

Building the chart with
breeze release-management prepare-helm-chart-package after the move
revealed that the published chart .tgz had been bundling four files
that chart consumers do not need:

  • pyproject.toml (workspace-member metadata for the chart's pytest
    / mypy config — irrelevant to consumers)
  • .pre-commit-config.yaml (local dev/CI hook config)
  • docs/ (chart documentation source — already rendered to
    airflow.apache.org/docs/helm-chart/, no need to ship inside the .tgz)
  • newsfragments/ (towncrier source for building RELEASE_NOTES.rst
    at release time)

All four are now in chart/.helmignore, so the packaged set drops
from 19 → 16 top-level entries. To keep this from drifting again:

  • New script
    scripts/ci/verify_helm_chart_package.py
    reads a packaged .tgz, asserts the top-level entries match an
    explicit allowlist, and runs helm lint against the same archive.
    Any newly-introduced top-level file fails the check until it is
    either added to the allowlist (chart-relevant) or to
    .helmignore (dev-only). Runnable locally:

    uv run scripts/ci/verify_helm_chart_package.py dist/airflow-1.22.0.tgz
  • The verifier is wired into the existing tests-helm-release job
    in .github/workflows/helm-tests.yml, right after
    prepare-helm-chart-package produces the artifact and before
    signing — a regression in the packaged set fails CI immediately.

Caveat for local devs

Developers running breeze via uvx --from dev/breeze (the standard
ADR-0017 shim) may need a one-time uv cache clean (or just
touch dev/breeze/pyproject.toml) after pulling this commit so uvx
rebuilds breeze from the current source. uvx caches by content hash
and will otherwise serve a stale breeze that still references the old
helm-tests/tests/helm_tests path. CI runs aren't affected (each job
gets a fresh uv cache).

Test plan

  • prek run --all-files passes (only the unrelated FAB pnpm
    ENAMETOOLONG issue from this worktree's nested path remains).
  • Run mypy for helm-tests (the mypy-helm-tests hook on
    chart/.pre-commit-config.yaml) passes against chart/tests/.
  • Lint Helm Chart, Kubeconform, Validate chart annotations
    and the chart schema/yaml hooks all pass.
  • uv run --project dev/breeze pytest dev/breeze/tests/test_pytest_args_for_test_types.py dev/breeze/tests/test_selective_checks.py — 194 passed.
  • breeze release-management prepare-helm-chart-package builds a
    280 KB airflow-1.22.0.tgz whose 16 top-level entries match
    the verifier's allowlist; helm lint passes.
  • uv run scripts/ci/verify_helm_chart_package.py dist/airflow-1.22.0.tgz
    reports top-level contents: OK / helm lint: OK.
  • CI Helm tests job runs against the new path on this PR.
  • CI Static checks job stays green.

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 4.7)

Generated-by: Claude Code (Opus 4.7) following the guidelines

The Helm chart Python tests previously lived as their own workspace
member at `helm-tests/` with a dedicated `apache-airflow-helm-tests`
package. The chart sources and tests are inseparable in practice, so
this collapses them into a single `chart` workspace member: the test
files move under `chart/tests/`, and `helm-tests/pyproject.toml` is
merged into `chart/pyproject.toml` (which adopts the helm-tests
pytest config, the `mypy` dependency-group, and the test-only deps
on `apache-airflow-devel-common` and
`apache-airflow-providers-cncf-kubernetes`).

Names that are user/CI-visible are intentionally preserved:

* `breeze testing helm-tests` — command name unchanged.
* `mypy-helm-tests` — prek hook id unchanged (now lives in
  `chart/.pre-commit-config.yaml`, pointing at `chart/tests`).
* `run-helm-tests` — selective-checks output / CI gate, unchanged.
* `helm-tests.yml` — CI workflow file, unchanged.
* The directory `chart/tests/helm_tests/` keeps the Python package
  name `helm_tests` so test imports / module paths don't shift.

Path references updated everywhere they pointed at the old layout:
root `pyproject.toml` (workspace members, `[tool.uv.sources]`,
`apache-airflow-helm-chart = false` constraint rows, ruff per-file
ignores, mypy include path, dev dependency-group); `.github/CODEOWNERS`
(folded the `/helm-tests/` line into the existing `/chart/` entry —
same owners); `.github/dependabot.yml` and
`dev/update_github_branch_config.py`; breeze internals
(`global_constants.all_helm_test_packages`,
`run_tests.TEST_GROUP_TO_TEST_FOLDERS[GroupOfTests.HELM]`,
`run_tests.find_pytest_arguments`, `docker_command_utils` mounts,
`selective_checks` regexes); `scripts/ci/docker-compose/local.yml` and
`scripts/ci/prek/run_mypy_full_dist_local_venv_or_breeze_in_ci.py`
(with a `FOLDER_TO_PROJECT["chart/tests"] = "chart"` override since
`chart/tests` is not its own uv project); `dev/ide_setup/setup_idea.py`;
root `.pre-commit-config.yaml` exclusions; docs in
`contributing-docs/testing/helm_unit_tests.rst` and
`dev/breeze/doc/ci/04_selective_checks.md`; existing breeze unit tests
in `dev/breeze/tests/test_*.py`. `uv.lock` regenerated.

NOTE: developers running `breeze` via `uvx --from dev/breeze` may need
a one-time `uv cache clean` (or `touch dev/breeze/pyproject.toml`)
after pulling this commit so uvx rebuilds breeze from the current
source — uvx caches by content hash and will otherwise serve a stale
breeze that still references the old `helm-tests/tests/helm_tests`
path.
Locally building the chart with `breeze release-management
prepare-helm-chart-package` after the helm-tests → chart/tests move
revealed that the published chart `.tgz` was bundling four files that
chart consumers do not need and that we did not realise had been
shipping for a while:

* `pyproject.toml` (workspace-member metadata for the chart's pytest /
  mypy config — irrelevant to consumers)
* `.pre-commit-config.yaml` (local dev/CI hook config)
* `docs/` (chart documentation source — rendered to
  airflow.apache.org/docs/helm-chart/, not needed inside the .tgz)
* `newsfragments/` (towncrier source for building RELEASE_NOTES.rst at
  release time)

Add all four to `chart/.helmignore` so they are no longer bundled.

To make sure this doesn't drift again, add a small verification script
`scripts/ci/verify_helm_chart_package.py` that:

* Reads the packaged `.tgz` and asserts the top-level entries match an
  explicit allowlist (Chart.yaml, values.yaml, templates/, etc.). Any
  newly-introduced top-level file fails the check until it is either
  added to the allowlist (chart-relevant) or to `.helmignore` (dev-only).
* Runs `helm lint` against the same `.tgz`.

Wire the script into the existing `tests-helm-release` job in
`.github/workflows/helm-tests.yml`, right after
`prepare-helm-chart-package` produces the artifact and before signing,
so a regression in the packaged set fails CI immediately.

The script is also runnable locally:

    uv run scripts/ci/verify_helm_chart_package.py dist/airflow-1.22.0.tgz
@potiuk potiuk requested a review from kaxil as a code owner May 5, 2026 08:42
Copy link
Copy Markdown
Contributor

@jscheffl jscheffl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some merge conflicts now... but otherwise - cool! Thanks for the cleanup!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:dev-tools area:helm-chart Airflow Helm Chart backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants