test(admin): cover expand command dispatch#182
Merged
Conversation
Contributor
There was a problem hiding this comment.
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 starthits/rustfs/admin/v3/rebalance/startand returns the “Expansion rebalance started successfully” JSON payload (including operation id). - Adds coverage verifying
admin expand stophits/rustfs/admin/v3/rebalance/stopand 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.
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.
Problem Background and User Impact
PR #180 added
rc admin expandand thescalealias 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 thatadmin scale startreaches/rustfs/admin/v3/rebalance/startand thatadmin expand stopreaches/rustfs/admin/v3/rebalance/stop, while also asserting the expansion-specific JSON output.Test Status
cargo test -p rustfs-cli --test admin_expandcargo fmt --all --checkgit diff --checkmake pre-commit