Skip to content

[quality] kube.py shared helpers have no unit tests #182

@kubestellar-hive

Description

@kubestellar-hive

Finding

tests/service_catalog/shared/kube.py provides six helper functions used by every homelab test suite (homelab_access, homelab_backup, homelab_storage, homelab_substrate):

  • run_kubectl(*args) — subprocess wrapper
  • require_kubectl(*args) — asserting subprocess wrapper
  • get_pods_json() — JSON pod list fetcher
  • restart_workload() — deployment restart + rollout wait
  • first_pod_name() — pod name resolver
  • http_get() — in-cluster HTTP probe

None of these have unit tests. A bug in any helper silently breaks multiple test suites and may mask real environment failures.

Additional note: test_k8s_lifecycle.py duplicates run_kubectl and write_artifact locally instead of importing from kube.py, meaning the shared module is not exercised by that suite.

Recommendation

  1. Add tests/service_catalog/shared/test_kube.py with mocked subprocess.run for all six functions.
  2. Add a unit-tests.yml CI workflow that runs pytest on every PR.
  3. Refactor test_k8s_lifecycle.py to import from kube.py.

Priority

  • Impact: high
  • Effort: low

Filed by quality agent (hold-gated mode)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions