Skip to content

test(alias): cover invalid signature JSON error#194

Open
overtrue wants to merge 1 commit into
mainfrom
codex/test-alias-set-json-validation
Open

test(alias): cover invalid signature JSON error#194
overtrue wants to merge 1 commit into
mainfrom
codex/test-alias-set-json-validation

Conversation

@overtrue
Copy link
Copy Markdown
Contributor

Related issue(s)

None.

Background

Recent alias validation changes made local alias set usage errors go through the JSON-aware formatter. The existing regression covered embedded endpoint credentials, but the invalid --signature branch was still unpinned.

Solution

Add a focused subprocess error-contract test for rc alias set --signature v5 --json. The test asserts stderr JSON metadata, exit code 2, empty stdout, and that no alias is persisted after validation fails.

Validation

  • cargo test -p rustfs-cli --test error_contract alias_set_json_error_rejects_invalid_signature
  • make pre-commit

@overtrue overtrue marked this pull request as ready for review May 10, 2026 21:13
Copilot AI review requested due to automatic review settings May 10, 2026 21:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a regression test to pin the JSON error contract for rc alias set when --signature is invalid, ensuring CLI usage validation failures produce structured JSON on stderr and do not persist config changes.

Changes:

  • Add a subprocess-based error-contract test for rc alias set --signature v5 --json.
  • Assert exit code 2, empty stdout, and JSON error metadata on stderr.
  • Verify no alias is persisted after validation fails by checking rc alias list --json.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants