Skip to content

Enhancement | Testing strategy: review and action plan #346

Done

Description

@diego-ojeda-binbash

What

A critical review of the CLI's testing strategy (run on master @ 5dc5bd6, 2026-11-09). It covers which test types we use, where each one runs in the SDLC, and how coverage lines up with risk. It also proposes an action plan.

Full report (in Spanish, with diagrams): https://claude.ai/artifact/GAVjmZpM34E4LD3UVe9E95

Verdict

The test types we picked fit a CLI that wraps external binaries and AWS APIs: unit tests, in-process CLI tests, black-box bats and a real-AWS E2E. The problem was how we applied them:

  • No check was required to merge, so the unit tests stayed red on master from Feat | Remove docker dependency #316 to Fix | Restore the unit test suite #322 (Apr–Sep 2026).
  • The PyPI release ran zero tests.
  • The E2E ran in the wrong phase, with an obsolete matrix.
  • The riskiest paths had the lowest coverage: SSO (aws.py 41%), project create (project.py 32%), and plan/apply/--layers.

Overall branch coverage was 66%, across 225 pytest tests and 10 bats tests.

Already done

Pending

Ordered by impact and effort:

Test-type review (2026-11-26)

A pass over a common catalog of ~45 test types (pre-merge, pre-release, rollout and production) to check which ones we already use and which ones are worth adding. The four new pending items above come from here.

Already in place: unit, functional/component (CliRunner), static analysis and lint (mypy, ruff, black), coverage with a floor (fail_under = 75), integration (bats with real tofu/terraform), config/compat (tofu/terraform version matrix + macOS), acceptance/E2E (ref-arch on real AWS per PR), smoke (the built wheel is installed and its version checked before publishing), regression (every fix adds its test; golden files are the H7 project part), and a partial canary (RCs on TestPyPI).

Worth adding, ranked by value for effort: golden files (already H7), property-based tests, contract tests with the ref-arch, static security + threat model, and mutation testing now and then.

Not worth it, and why:

  • Rollout and production practices (canarying, traffic shaping, feature flags, A/B, real user monitoring, tracing, tap compare, shadowing, teeing, on-call): they assume a service that receives traffic. The CLI is a short-lived process on the user's machine; there is no traffic to split, mirror or watch.
  • Monitoring, exception tracking and central logs: they would need telemetry leaving our clients' infrastructure environments. The trust and privacy cost is far higher than what we'd learn.
  • Load, soak, performance, benchmark and profiling: a run's time is spent in tofu and AWS, not in the CLI. The only cheap exception is startup time (python -X importtime), worth checking only if someone reports slowness.
  • Fuzzing and formal verification: the inputs are local files written by the user; property-based tests cover that risk at a fraction of the cost.
  • Chaos and penetration testing: there is no network surface or infrastructure of our own; the threat model gives more for less.
  • Usability and UI/UX tests: for a CLI these are the output and the error messages, which the golden files cover.
  • AWS emulators (moto/Floci/LocalStack) only help in part: none of the ones we evaluated covers the SSO portal, sso-oidc or identitystore.

🤖 Generated with Claude Code

Activity

  1. diego-ojeda-binbash commented on Nov 27, 2026

    @diego-ojeda-binbash
    ContributorAuthor

    Done: every item is in Already done. The closing review reran the original analysis with the same method: report v2 (v1: 2026-11-09).

    • H1–H8 closed
    • pytest tests: 225 → 470; bats: 10 → 16
    • branch coverage: 66% → 85.5%
    • required checks on master: 0 → 7
    • 23 CLI bugs found and fixed

    What's left is tracked in #394.

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

Metadata

Metadata

Labels

enhancementtest

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions