-
Notifications
You must be signed in to change notification settings - Fork 218
[ISSUE #5375]🧪Add test case for ProtocolError #5445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
🔊@WaterWhisperer 🚀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💥. |
WalkthroughUnit tests are added for various ProtocolError variants in the unified protocol error module, verifying correct error message formatting for scenarios including unsupported versions, missing headers and bodies, invalid messages, decode errors, and unsupported serialization types. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
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. Comment |
There was a problem hiding this 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 (1)
rocketmq-error/src/unified/protocol.rs (1)
90-116: Consider adding helper methods for remaining variants.For consistency with existing patterns (e.g.,
invalid_command,header_missing), consider adding helper methods forUnsupportedVersion,BodyMissing,DecodeError, andUnsupportedSerializationType. This would provide a uniform API and make the tests more consistent.Alternatively, you could split these into separate test functions (e.g.,
test_unsupported_version,test_body_missing) for better test isolation and clearer failure reporting.Example: Adding helper methods
impl ProtocolError { // ... existing helpers ... /// Create an unsupported version error #[inline] pub fn unsupported_version(version: i32) -> Self { Self::UnsupportedVersion { version } } /// Create a body missing error #[inline] pub fn body_missing() -> Self { Self::BodyMissing } /// Create a decode error #[inline] pub fn decode_error(ext_fields_len: usize, header_len: usize) -> Self { Self::DecodeError { ext_fields_len, header_len } } /// Create an unsupported serialization type error #[inline] pub fn unsupported_serialization_type(serialize_type: u8) -> Self { Self::UnsupportedSerializationType { serialize_type } } }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
rocketmq-error/src/unified/protocol.rs
⏰ 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). (5)
- GitHub Check: Build & Test (windows-latest)
- GitHub Check: Build & Test (macos-latest)
- GitHub Check: Build & Test (ubuntu-latest)
- GitHub Check: Code Coverage
- GitHub Check: auto-approve
🔇 Additional comments (1)
rocketmq-error/src/unified/protocol.rs (1)
90-116: Excellent test coverage additions!The new test cases correctly verify the error message formatting for all previously untested ProtocolError variants. Each assertion accurately matches the corresponding
#[error]attribute definition.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5445 +/- ##
==========================================
+ Coverage 37.83% 37.84% +0.01%
==========================================
Files 811 811
Lines 109905 109919 +14
==========================================
+ Hits 41582 41602 +20
+ Misses 68323 68317 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
rocketmq-rust-bot
left a comment
There was a problem hiding this 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 ✅
Which Issue(s) This PR Fixes(Closes)
Fixes #5375
Brief Description
How Did You Test This Change?
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.