Skip to content

Add dedicated tests for cncf.kubernetes secret and k8s_model modules - #73751

Merged
shahar1 merged 3 commits into
apache:mainfrom
KarthikMohankumar:k8s-provider-secret-k8s-model-tests
Sep 26, 2026
Merged

shahar1 merged 3 commits into
apache:mainfrom
KarthikMohankumar:k8s-provider-secret-k8s-model-tests

Conversation

@KarthikMohankumar

@KarthikMohankumar KarthikMohankumar commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

secret.py and k8s_model.py in the cncf.kubernetes provider were both on the OVERLOOKED_TESTS allowlist in test_project_structure.py.

Secret already had tests, but they lived in tests/unit/cncf/kubernetes/models/test_secret.py. There is no models package on the source side, so the structure check never matched them to secret.py. This PR:

  • moves them to tests/unit/cncf/kubernetes/test_secret.py, next to where the source lives, and drops the now-empty models/ test package
  • adds cases for constructor validation (invalid deploy_type, key without deploy_target), uppercasing of env deploy targets, __eq__/__hash__/__repr__, and a check that attach_to_pod doesn't mutate the input pod
  • adds test_k8s_model.py covering append_to_pod: None and empty lists return the pod unchanged, and each object receives the previous object's result
  • removes both entries from OVERLOOKED_TESTS

Tests only. No change to runtime behaviour.

related: #35442

Checks run locally:

  • uv run --project providers/cncf/kubernetes pytest tests/unit/cncf/kubernetes/test_secret.py tests/unit/cncf/kubernetes/test_k8s_model.py: 19 passed
  • test_project_structure.py::TestProjectStructure::test_providers_modules_should_have_tests: passed
  • prek run --stage pre-commit on the changed files (ruff, ruff-format, mypy-devel-common and the other applicable hooks): passed. ast-grep was skipped locally because it could not download its Node runtime.

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

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

The Secret tests lived under a models/ test package that has no matching source package, so the project-structure check could not see them and both modules stayed on the OVERLOOKED_TESTS allowlist. Placing the tests where the check expects them lets the allowlist shrink, and covers constructor validation, equality semantics and append_to_pod chaining, which were previously untested.
…Delete providers/cncf/kubernetes/tests/unit/cncf/kubernetes/models directory
@boring-cyborg

boring-cyborg Bot commented Sep 26, 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

@shahar1

shahar1 commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Welcome to Apache Airflow and thanks for your contribution!

@shahar1
shahar1 merged commit 005fd64 into apache:main Sep 26, 2026
107 checks passed
@boring-cyborg

boring-cyborg Bot commented Sep 26, 2026

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

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.

2 participants