Skip to content

test(admin): cover expand command dispatch#182

Merged
overtrue merged 1 commit intomainfrom
codex/test-admin-expand-routing
May 7, 2026
Merged

test(admin): cover expand command dispatch#182
overtrue merged 1 commit intomainfrom
codex/test-admin-expand-routing

Conversation

@overtrue
Copy link
Copy Markdown
Contributor

@overtrue overtrue commented May 7, 2026

Related Issue(s)

None.

Problem Background and User Impact

PR #180 added rc admin expand and the scale alias as an expansion-oriented wrapper around the existing rebalance workflow. The help and parser coverage prove the commands are discoverable, but they did not exercise the binary command path against an admin endpoint.

Root Cause Summary

The new command reuses the rebalance implementation with expansion-specific start and stop messages. Without an execution-level test, a dispatch regression could still parse successfully while failing to call the expected /rebalance/* admin routes or returning the wrong JSON operation message.

Solution Overview

This PR adds focused integration coverage for the expansion command path. A local one-shot HTTP server captures the signed admin request while the CLI uses an RC_HOST_* environment alias. The tests verify that admin scale start reaches /rustfs/admin/v3/rebalance/start and that admin expand stop reaches /rustfs/admin/v3/rebalance/stop, while also asserting the expansion-specific JSON output.

Test Status

  • cargo test -p rustfs-cli --test admin_expand
  • cargo fmt --all --check
  • git diff --check
  • make pre-commit

@overtrue overtrue marked this pull request as ready for review May 7, 2026 08:16
Copilot AI review requested due to automatic review settings May 7, 2026 08:16
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 an integration test to exercise the rc admin expand/rc admin scale execution path against an admin HTTP endpoint, ensuring the command dispatch reaches the expected rebalance routes and returns the expansion-specific JSON messages.

Changes:

  • Introduces a one-shot local HTTP server that captures the admin request method + target path.
  • Adds coverage verifying admin scale start hits /rustfs/admin/v3/rebalance/start and returns the “Expansion rebalance started successfully” JSON payload (including operation id).
  • Adds coverage verifying admin expand stop hits /rustfs/admin/v3/rebalance/stop and returns the “Expansion rebalance stopped successfully” JSON payload (without an id).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@overtrue overtrue merged commit 28251e8 into main May 7, 2026
19 checks passed
@overtrue overtrue deleted the codex/test-admin-expand-routing branch May 7, 2026 12:54
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