Skip to content

test(cli): cover top-level cors set parsing#100

Draft
overtrue wants to merge 1 commit intomainfrom
codex/top-level-cors-set-parser-gap
Draft

test(cli): cover top-level cors set parsing#100
overtrue wants to merge 1 commit intomainfrom
codex/top-level-cors-set-parser-gap

Conversation

@overtrue
Copy link
Copy Markdown
Contributor

@overtrue overtrue commented Apr 9, 2026

Summary

This change adds focused parser coverage for the deprecated top-level rc cors set entrypoint introduced with the recent bucket CORS management work. The current suite already covered rc bucket cors set ... and a few top-level rc cors flows, but it did not exercise the top-level set path itself.

The missing coverage mattered because the deprecated top-level command is still wired through Clap separately from rc bucket cors. A regression there would break users invoking rc cors set without being caught by the existing tests, even though the nested bucket command still worked.

Root cause

The original CORS feature and follow-up tests focused on bucket-path validation, help discoverability, source reading, and a subset of command aliases. The top-level set parser branch, including its legacy --file flag wiring and --force propagation, was left untested.

Fix

The test suite now verifies two narrow parser paths in crates/cli/src/commands/mod.rs:

  • rc cors set local/my-bucket cors.xml
  • rc cors set local/my-bucket --file cors.json --force

These assertions confirm the deprecated top-level command still maps to CorsCommands::Set, preserves the bucket path, selects the expected source field, and forwards the --force flag.

Validation

I ran the following checks successfully:

  • cargo test -p rustfs-cli cli_accepts_top_level_cors
  • cargo fmt --all --check
  • cargo clippy --workspace -- -D warnings
  • cargo test --workspace

I also attempted make pre-commit per automation instructions, but this repository currently has no Makefile or pre-commit target, so make exits with No rule to make target 'pre-commit'.

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.

1 participant