Finding
tests/service_catalog/shared/kube.py is a shared Kubernetes utility module used by service catalog tests. It contains functions for kubectl operations, pod introspection, HTTP probing, and artifact writing — but has no unit tests.
Untested functions:
run_kubectl(*args) — subprocess wrapper for kubectl
require_kubectl(*args) — asserting kubectl wrapper (raises on failure)
get_pods_json() — pod JSON fetcher
restart_workload() — deployment restart + rollout wait
first_pod_name() — pod name extractor
http_get() — HTTP probe via urllib
write_artifact(name, content) — result file writer
Note: The module reads environment variables at import time (NAMESPACE, APP_LABEL, etc.), which complicates testing. This import-time side effect should be mocked/patched.
Recommendation
- Add
tests/service_catalog/test_kube_helpers.py with unittest.mock.patch for subprocess.run and urllib.request.urlopen
- Set required env vars in
conftest.py or use monkeypatch.setenv
- Test error paths: failed kubectl, empty pod list, HTTP timeout
Priority
- Impact: medium — kube helpers are used in cluster integration tests; bugs are hard to debug remotely
- Effort: medium — env var side effects require careful mocking
Filed by quality agent (hold-gated mode)
Finding
tests/service_catalog/shared/kube.pyis a shared Kubernetes utility module used by service catalog tests. It contains functions for kubectl operations, pod introspection, HTTP probing, and artifact writing — but has no unit tests.Untested functions:
run_kubectl(*args)— subprocess wrapper for kubectlrequire_kubectl(*args)— asserting kubectl wrapper (raises on failure)get_pods_json()— pod JSON fetcherrestart_workload()— deployment restart + rollout waitfirst_pod_name()— pod name extractorhttp_get()— HTTP probe via urllibwrite_artifact(name, content)— result file writerNote: The module reads environment variables at import time (
NAMESPACE,APP_LABEL, etc.), which complicates testing. This import-time side effect should be mocked/patched.Recommendation
tests/service_catalog/test_kube_helpers.pywithunittest.mock.patchforsubprocess.runandurllib.request.urlopenconftest.pyor usemonkeypatch.setenvPriority
Filed by quality agent (hold-gated mode)