Skip to content

Scope CLI↔client contract test coverage #165

@sdairs

Description

@sdairs

Summary

The live integration tests exercise the typed Rust client library. The CLI (crates/clickhousectl/) is a thin wrapper over that library, so most regressions caught by cargo build cover both. But the CLI also assembles request bodies from clap-parsed args and prints responses — that assembly logic isn't tested today.

This issue is scoping work: figure out what contract coverage looks like and what it would catch.

Questions to answer

  • What classes of bug would slip through cargo build + library integration tests but be caught by CLI-level tests? Candidates:
    • CLI builds a request body that drops a required field.
    • CLI's --flag to API field mapping silently desyncs from the library's expected request shape.
    • CLI's JSON output mode doesn't round-trip through the library types (regression in Display vs serde).
  • Should this be assertion-on-snapshot (the CLI invocation produces an expected wire request), wiremock-driven (CLI hits a local mock, assert the request), or both?
  • Where does this live — crates/clickhousectl/tests/ (new), or extend client_test.rs to assert request shape only?

Out of scope

  • Implementing the coverage. This issue produces a proposal + a sub-issue or two with concrete scope.

Notes

  • This was raised in the context of why we don't path-filter live tests. The argument was: if CLI-only PRs run no live tests, we need some coverage that catches a broken contract. Until contract tests exist, we run live everywhere.

Parent: #151

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesttest-coverageLive API integration test coverage work

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