test(cli): add --help regression test for lafiya-cli - #296
Open
Sundriveauto wants to merge 1 commit into
Open
Conversation
Runs the compiled binary with --help for the top-level command and every subcommand, asserting each prints usage text and exits successfully. A clap derive regression (bad attribute, arg conflict, rendering failure) would previously only be caught by a human running the CLI. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
|
@Sundriveauto Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #189
Closes #190
Closes #191
Closes #192
Description
Adds an automated regression test that runs the compiled
lafiya-clibinary with--helpfor the top-level command and every subcommand, asserting that each prints usage text to stdout and exits successfully (exit code 0).Previously, a clap derive regression (e.g. a malformed attribute, an argument conflict, or a name that fails to render) would only be caught by a human running the CLI manually. This test suite now catches it in CI as part of the existing
cargo test --workspacejob (make test) — no workflow changes needed.Coverage (12 tests, one per command node):
lafiya-cli --helpconfigand its leaves:config show,config list,config envattesterand its leaves:attester is,attester add,attester removeattestationand its leaves:attestation getdeployThe tests spawn the real compiled binary via Cargo's
CARGO_BIN_EXE_lafiya-clivariable (note: Cargo keeps the hyphen in the variable name), so no config file or network access is required — clap handles--helpbefore any config loading. If a new subcommand is added, the file's doc comment points to where to add a matching test.Verification:
cargo test -p lafiya-cli(12 passed),cargo fmt --all -- --check, andcargo clippy -p lafiya-cli --all-targets -- -D warningswere run in arust:1container (no local Rust toolchain in this environment). The fullmake checkwas not run because it includes thewasmtarget build, which per the Makefile comment does not apply to the std-onlylafiya-clicrate; this change touches only that crate.Type of Change
Quality Checklist
make checklocally and it passes with no warnings or errorsCross-Repo & Shared-Contract Impact
Does this PR change a shared contract interface? (e.g., attestation schema, public contract function signatures, events emitted)
Does this PR require a database/Supabase migration?
lafiya-web.lafiya-web/lib/supabase/types.tshave been updated manually.