Skip to content

test(alias): cover empty RC_HOST alias name#200

Open
overtrue wants to merge 1 commit into
mainfrom
test/rc-host-empty-alias-name
Open

test(alias): cover empty RC_HOST alias name#200
overtrue wants to merge 1 commit into
mainfrom
test/rc-host-empty-alias-name

Conversation

@overtrue
Copy link
Copy Markdown
Contributor

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 variable RC_HOST_ was only covered indirectly by the core parser behavior.

Root cause

RC_HOST_ reaches AliasManager::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 core Config usage-error exit code and JSON metadata.

Solution

Add a focused crates/cli/tests/env_alias.rs subprocess regression for rc alias list --json with RC_HOST_ set. The test verifies exit code 2, stderr JSON, usage_error metadata, 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_error
  • cargo test -p rustfs-cli --test env_alias
  • make pre-commit

@overtrue overtrue marked this pull request as ready for review May 13, 2026 21:12
Copilot AI review requested due to automatic review settings May 13, 2026 21:12
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 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 --json with RC_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.

Comment thread crates/cli/tests/env_alias.rs Outdated
Comment thread crates/cli/tests/env_alias.rs
@overtrue overtrue force-pushed the test/rc-host-empty-alias-name branch from 6c23908 to 31e9d01 Compare May 13, 2026 21:18
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