Skip to content

test(alias): cover remove config error JSON code#195

Open
overtrue wants to merge 1 commit into
mainfrom
test/alias-remove-config-error
Open

test(alias): cover remove config error JSON code#195
overtrue wants to merge 1 commit into
mainfrom
test/alias-remove-config-error

Conversation

@overtrue
Copy link
Copy Markdown
Contributor

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, runs rc alias remove stale --json, and verifies the command exits with code 1 while emitting stderr JSON that includes code: 1 and general_error metadata.

Validation

  • cargo test -p rustfs-cli --test alias_config_error
  • make pre-commit

@overtrue overtrue marked this pull request as ready for review May 12, 2026 01:18
Copilot AI review requested due to automatic review settings May 12, 2026 01:18
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 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.toml and runs rc alias remove stale --json.
  • Verifies the command exits with code 1 and 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.

Comment thread crates/cli/tests/alias_config_error.rs Outdated
Comment thread crates/cli/tests/alias_config_error.rs Outdated
@overtrue overtrue force-pushed the test/alias-remove-config-error branch from 89bb927 to 44e353a Compare May 12, 2026 01:24
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