Skip to content

[Feature] Gate coverage and close the weakest unit-test gaps #645

Description

@ian-flores

Coverage is measured on every CI run and then discarded. ci.yml's selftest job runs pytest selftests/ --cov=src/vip --cov-report=term-missing, but there is no --cov-fail-under, no Codecov integration and no threshold anywhere, so the number can drift downward indefinitely without anyone noticing.

Measured on main at 66a0c54 with uv run --extra dev pytest selftests/ --cov=src/vip: 1923 passed, 3 skipped, TOTAL 5263 statements, 1300 missed, 75%.

Weakest modules, worst first:

Module Statements Missed Cover
src/vip/load_users.py 83 83 0%
src/vip/clients/kubernetes.py 62 51 18%
src/vip/clients/packagemanager.py 77 53 31%
src/vip/idp.py 225 143 36%
src/vip/clients/connect.py 272 163 40%
src/vip/config.py 258 147 43%
src/vip/version.py 42 19 55%

Three of these are worth prioritising for reasons beyond the raw number. clients/kubernetes.py at 18% is the weakest and backs a real product path, session capacity on Kubernetes; the only selftest that mentions Kubernetes exercises a configuration dataclass rather than the client itself. idp.py at 36% is the headless-auth IdP login strategy, which is security-sensitive. config.py at 43% is the single source of truth for parsing vip.toml, is pure logic with no I/O, and so is the cheapest of the three to cover meaningfully; configuration mistakes are also among the most common things a field user actually hits.

load_users.py at literal 0% is a separate decision rather than a gap to fill blindly: it is locust-backed load-generation code reached through load_engine.py, and is opt-in. Either give it minimal coverage or exclude it explicitly, so that 0% becomes a recorded decision instead of an accident.

Suggested first step: add --cov-fail-under set to the current value, so the number can only move up, then take config.py as the first target.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions