Skip to content

Conversation

@mxsm
Copy link
Owner

@mxsm mxsm commented Jan 7, 2026

Which Issue(s) This PR Fixes(Closes)

Fixes #5521

Brief Description

How Did You Test This Change?

Summary by CodeRabbit

  • Documentation

    • Added example configuration file for RocketMQ Name Server demonstrating all available configurable options and default values.
  • Tests

    • Added test scripts to validate Name Server features including configuration help output, default settings, command-line overrides, and file-based configurations.

✏️ Tip: You can customize this high-level summary in your review settings.

@rocketmq-rust-bot
Copy link
Collaborator

🔊@mxsm 🚀Thanks for your contribution🎉!

💡CodeRabbit(AI) will review your code first🔥!

Note

🚨The code review suggestions from CodeRabbit are to be used as a reference only, and the PR submitter can decide whether to make changes based on their own judgment. Ultimately, the project management personnel will conduct the final code review💥.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 7, 2026

Walkthrough

Adds example configuration for RocketMQ Name Server and corresponding test scripts for Linux (Bash) and Windows (PowerShell) environments. The configuration file demonstrates all available options with defaults, while both test scripts validate core behaviors including help output, default configuration printing, file-based configuration, command-line overrides, and configuration precedence.

Changes

Cohort / File(s) Summary
Configuration Example
rocketmq-namesrv/resource/namesrv-example.toml
New TOML file documenting all configurable Name Server options with default values, including installation paths, persistence settings, thread pool configs, feature toggles, and non-persisted property blacklist. Uses both snake_case and camelCase naming via serde aliases.
Test Scripts
scripts/test_namesrv_features.sh, scripts/test_namesrv_features.ps1
Two new test scripts (Bash and PowerShell) that validate Name Server features by: building the Rust binary, displaying help, printing default/file/override/combined configurations, and comparing with Java version parity. Both scripts follow identical 5-test sequence with conditional skips for missing config files.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A Name Server now configured clear,
With examples and scripts, the path is dear.
From Unix to Windows, tests align,
Configuration defaults perfectly shine—
A rabbit hops through features fine! 🚀

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main changes: adding example configuration and test scripts for RocketMQ Name Server.
Linked Issues check ✅ Passed The PR implements the stated objective from issue #5521 by adding an example configuration file (namesrv-example.toml) and two feature test scripts (Bash and PowerShell) for the RocketMQ Name Server.
Out of Scope Changes check ✅ Passed All three files added are directly related to the stated objectives: a configuration example and two test scripts for RocketMQ Name Server features.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
scripts/test_namesrv_features.sh (3)

36-45: Quote variables to handle paths with spaces.

The $TEST_CONFIG variable should be quoted to prevent word splitting and globbing issues if the path ever contains spaces or special characters.

🔎 Proposed fix
 if [ -f "$TEST_CONFIG" ]; then
     echo "Test 3: Print configuration from file"
     echo "Command: $NAMESRV_BIN -c $TEST_CONFIG -p"
-    $NAMESRV_BIN -c $TEST_CONFIG -p > /tmp/namesrv_file_config.txt
+    "$NAMESRV_BIN" -c "$TEST_CONFIG" -p > /tmp/namesrv_file_config.txt
     echo "[OK] Test 3 passed - Output saved to /tmp/namesrv_file_config.txt"
     echo ""
 else

47-64: Apply consistent quoting for robustness.

Same quoting issue applies to Tests 4 and 5 for shell variable safety.

🔎 Proposed fix
 # Test 4: Override parameters
 echo "Test 4: Print configuration with command line overrides"
 echo "Command: $NAMESRV_BIN --listenPort 19876 --bindAddress 127.0.0.1 -p"
-$NAMESRV_BIN --listenPort 19876 --bindAddress 127.0.0.1 -p > /tmp/namesrv_override_config.txt
+"$NAMESRV_BIN" --listenPort 19876 --bindAddress 127.0.0.1 -p > /tmp/namesrv_override_config.txt
 echo "[OK] Test 4 passed - Output saved to /tmp/namesrv_override_config.txt"
 echo ""

 # Test 5: Combined test - config file + overrides
 if [ -f "$TEST_CONFIG" ]; then
     echo "Test 5: Configuration file + command line overrides"
     echo "Command: $NAMESRV_BIN -c $TEST_CONFIG --listenPort 29876 --rocketmqHome /tmp/rocketmq -p"
-    $NAMESRV_BIN -c $TEST_CONFIG --listenPort 29876 --rocketmqHome /tmp/rocketmq -p > /tmp/namesrv_combined_config.txt
+    "$NAMESRV_BIN" -c "$TEST_CONFIG" --listenPort 29876 --rocketmqHome /tmp/rocketmq -p > /tmp/namesrv_combined_config.txt
     echo "[OK] Test 5 passed - Output saved to /tmp/namesrv_combined_config.txt"
     echo ""
 else

21-33: Quote binary path variable.

For consistency and robustness, quote $NAMESRV_BIN in Tests 1 and 2 as well.

🔎 Proposed fix
 # Test 1: Display help
 echo "Test 1: Display help information"
 echo "Command: $NAMESRV_BIN --help"
-$NAMESRV_BIN --help
+"$NAMESRV_BIN" --help
 echo "[OK] Test 1 passed"
 echo ""

 # Test 2: Print config with default values
 echo "Test 2: Print configuration with defaults"
 echo "Command: $NAMESRV_BIN -p"
-$NAMESRV_BIN -p > /tmp/namesrv_default_config.txt
+"$NAMESRV_BIN" -p > /tmp/namesrv_default_config.txt
 echo "[OK] Test 2 passed - Output saved to /tmp/namesrv_default_config.txt"
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between af39fed and c5ec454.

📒 Files selected for processing (3)
  • rocketmq-namesrv/resource/namesrv-example.toml
  • scripts/test_namesrv_features.ps1
  • scripts/test_namesrv_features.sh
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Check (fmt + clippy)
  • GitHub Check: auto-approve
🔇 Additional comments (2)
rocketmq-namesrv/resource/namesrv-example.toml (1)

1-96: LGTM! Well-documented example configuration.

The configuration file is comprehensive with clear comments explaining each option's purpose and default value. The support for both snake_case and camelCase naming through serde aliases is a nice touch for user flexibility.

scripts/test_namesrv_features.ps1 (1)

1-77: LGTM! Well-structured PowerShell test script.

The script correctly uses PowerShell idioms (& call operator, Test-Path, $ErrorActionPreference) and provides good visual feedback with colored output. It maintains functional parity with the Bash version while adapting to Windows conventions.

Copy link
Collaborator

@rocketmq-rust-bot rocketmq-rust-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - All CI checks passed ✅

@rocketmq-rust-bot rocketmq-rust-bot merged commit 388d6d7 into main Jan 7, 2026
18 checks passed
@rocketmq-rust-bot rocketmq-rust-bot added approved PR has approved and removed ready to review waiting-review waiting review this PR labels Jan 7, 2026
@codecov
Copy link

codecov bot commented Jan 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 38.40%. Comparing base (8405bcd) to head (c5ec454).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5522      +/-   ##
==========================================
- Coverage   38.42%   38.40%   -0.03%     
==========================================
  Files         815      815              
  Lines      110451   110515      +64     
==========================================
  Hits        42443    42443              
- Misses      68008    68072      +64     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement✨] Add example configuration and feature test scripts for RocketMQ Name Server

4 participants