test(alias): cover empty RC_HOST alias name#200
Open
overtrue wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a focused CLI integration regression test for malformed environment alias handling when RC_HOST_ has no alias name.
Changes:
- Adds a subprocess test for
rc alias list --jsonwithRC_HOST_. - Verifies usage-error exit code, JSON error metadata, and credential redaction from stderr.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
6c23908 to
31e9d01
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 error handling work changed malformed
RC_HOST_*environment aliases to report structured usage errors from the alias list command. Existing subprocess coverage checks invalid schemes and malformed credential percent encoding, but the empty alias-name variableRC_HOST_was only covered indirectly by the core parser behavior.Root cause
RC_HOST_reachesAliasManager::list()through the environment alias loader and fails before any alias is built. Before the recent alias command error-code handling, this path could fall back to a generic alias-list error response instead of preserving the coreConfigusage-error exit code and JSON metadata.Solution
Add a focused
crates/cli/tests/env_alias.rssubprocess regression forrc alias list --jsonwithRC_HOST_set. The test verifies exit code 2, stderr JSON,usage_errormetadata, and that credential material from the malformed environment value is not echoed.Validation
cargo test -p rustfs-cli --test env_alias alias_list_rejects_empty_rc_host_alias_name_as_usage_errorcargo test -p rustfs-cli --test env_aliasmake pre-commit