Skip to content

Add Kubernetes provider utility test coverage - #72461

Open
YusefSyed wants to merge 2 commits into
apache:mainfrom
YusefSyed:codex/kubernetes-provider-tests
Open

YusefSyed wants to merge 2 commits into
apache:mainfrom
YusefSyed:codex/kubernetes-provider-tests

Conversation

@YusefSyed

@YusefSyed YusefSyed commented Sep 3, 2026 •

Copy link
Copy Markdown

Closes #72265.

The Kubernetes task source-rewrite and YAML deletion utilities had no direct tests. This adds coverage for generated task source, API dispatch and deletion error reporting, and removes their two corresponding OVERLOOKED_TESTS exemptions.

The tests cover task/lifecycle decorator removal, unrelated decorators, Jinja rendering, missing context, API-group/kind conversion, namespaced and cluster-scoped deletion, namespace precedence, List expansion, aggregated errors, YAML forwarding and verbose status output. Kubernetes API constructors use autospec=True, and response doubles expose only their expected status interface; no cluster is required.

Rebased onto current Apache main at 18fe1c60986, retaining the September 18 review coverage and upstream's removal of other obsolete test exemptions. The scope remains two test modules and their matching exemptions; production utilities are unchanged.

Verification

On head b4cab189b1e with the documented UV project commands, importing both utilities from this checkout:

  • uv run --project providers/cncf/kubernetes pytest providers/cncf/kubernetes/tests/unit/cncf/kubernetes/test_python_kubernetes_script.py providers/cncf/kubernetes/tests/unit/cncf/kubernetes/utils/test_delete_from.py -q: 17 passed.
  • uv run --project airflow-core pytest airflow-core/tests/unit/always/test_project_structure.py -xvs: 10 passed, 1 expected failure.
  • Regular and manual prek checks, Ruff, commit-message hook and git diff --check: passed.
  • Breeze selective-check ran; the full system/hosted CI matrix is assessed separately from these local focused checks.

Was generative AI tooling used to co-author this PR?
  • Yes - OpenAI Codex

Generated-by: OpenAI Codex following the project's Gen-AI contribution guidelines.

@boring-cyborg boring-cyborg Bot added area:providers provider:cncf-kubernetes Kubernetes (k8s) provider related issues labels Sep 3, 2026
@boring-cyborg

boring-cyborg Bot commented Sep 3, 2026

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example Dag that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@YusefSyed
YusefSyed marked this pull request as ready for review September 3, 2026 00:03
@YusefSyed
YusefSyed marked this pull request as draft September 3, 2026 00:25
@YusefSyed
YusefSyed force-pushed the codex/kubernetes-provider-tests branch from 339a495 to c1f8ef3 Compare September 4, 2026 05:31
@YusefSyed
YusefSyed marked this pull request as ready for review September 4, 2026 15:56
@YusefSyed
YusefSyed marked this pull request as draft September 4, 2026 18:15
@YusefSyed
YusefSyed marked this pull request as ready for review September 4, 2026 18:16
@Subham-KRLX

Copy link
Copy Markdown
Contributor

Took a look at the tests and noticed a few missing things from the issue You still need coverage for the decorator scope edge cases mentioned in the issue description Also delete_from_yaml and the verbose flag are not covered yet Plus please switch monkeypatch to standard mock patch decorators with autospec as per Airflow testing guidelines.

@YusefSyed
YusefSyed force-pushed the codex/kubernetes-provider-tests branch from c1f8ef3 to b6756dc Compare September 22, 2026 23:25
@YusefSyed

Copy link
Copy Markdown
Author

Hi @Subham-KRLX, the requested decorator-scope, delete_from_yaml and verbose coverage is included in b6756dc, along with autospecced mock patching. The branch is rebased and the focused provider tests and project-structure checks pass locally. The current hosted workflows are awaiting maintainer approval; could a committer approve them when convenient? Happy to address any remaining review feedback.

Codex-assisted follow-up, posted with my approval.

The decorator source rewriting and YAML deletion helpers can silently corrupt user code or hide aggregate API failures without focused regression coverage.
Keep generated task source and YAML deletion behavior protected against regressions identified in review.

This branch has not been deployed

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

Labels

area:providers provider:cncf-kubernetes Kubernetes (k8s) provider related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add missing tests for cncf.kubernetes script and delete utilities

2 participants