test(alias): cover remove config error JSON code#195
Open
overtrue wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new CLI contract test to ensure rc alias remove --json reports config-load failures as structured JSON errors with an explicit exit code, covering a previously untested regression path in alias removal.
Changes:
- Introduces a new error-contract test that writes an invalid
config.tomland runsrc alias remove stale --json. - Verifies the command exits with code
1and emits JSON error metadata on stderr (code,details.type,details.retryable).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
89bb927 to
44e353a
Compare
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.
Related issue(s)
None.
Background
Recent alias command error handling changed generic alias operation failures to emit JSON errors with explicit exit codes. Existing coverage exercises malformed RC_HOST validation and alias set validation, but alias remove did not have a subprocess regression for config-load failures.
Solution
Add a focused alias remove error-contract test that writes a malformed
config.toml, runsrc alias remove stale --json, and verifies the command exits with code 1 while emitting stderr JSON that includescode: 1andgeneral_errormetadata.Validation
cargo test -p rustfs-cli --test alias_config_errormake pre-commit