-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
test: fix failing runtime/v2
test
#22760
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThe changes in this pull request modify the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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
🧹 Outside diff range and nitpick comments (1)
runtime/v2/services_test.go (1)
42-46
: Consider adding edge cases to strengthen test coverageWhile the current test effectively verifies the basic service registration flow, consider adding test cases for:
- Multiple module registrations
- Error scenarios when registration fails
- Validation of the actual routing behavior through the wrapper
This would provide more comprehensive coverage of the
stfRouterWrapper
integration.Would you like me to help generate additional test cases to improve coverage?
📜 Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
📒 Files selected for processing (1)
runtime/v2/services_test.go
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
runtime/v2/services_test.go (2)
Pattern **/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern **/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"
🔇 Additional comments (2)
runtime/v2/services_test.go (2)
45-46
: LGTM! Mock expectations are properly configured
The mock expectations are correctly set up with:
- Proper pointer receivers for the wrapped routers
- Single call verification using
.Once()
- Consistent pattern for both message and query handlers
This change aligns well with the PR objective of fixing the failing test due to the stfRouterWrapper
integration.
42-43
: Verify the implementation of newStfRouterWrapper
The test uses newStfRouterWrapper
which is crucial for the fix, but we should verify its implementation to ensure it properly wraps the router builders.
✅ Verification successful
newStfRouterWrapper
implementation is correct and consistent
The implementation in runtime/v2/manager.go
shows that newStfRouterWrapper
properly initializes a wrapper structure with:
- A router builder field (
stfRouter
) - An error field initialized to nil
- A handlers map initialized as empty
The usage in the test file is consistent with this implementation, wrapping both message and query router builders in the same way. The wrapper provides a clean abstraction for handling routing functionality while maintaining error state and handler mappings.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for the implementation of newStfRouterWrapper
ast-grep --pattern 'func newStfRouterWrapper($$$) $$$'
# Search for any related tests of the wrapper
rg -g '**/*_test.go' 'newStfRouterWrapper'
Length of output: 663
Script:
#!/bin/bash
# Let's check the stfRouterWrapper type definition and its usage
ast-grep --pattern 'type stfRouterWrapper struct {$$$}'
# Let's also check how queryRouterBuilder is used with this wrapper
rg "queryRouterBuilder.*stfRouterWrapper" -A 3 -B 3
Length of output: 415
Fixes a test that must have been failing once the
stfRouterWrapper
type was added to wrapRouterBuilder
s.The incorrect type was being expected in the Mock statement
Summary by CodeRabbit