-
Notifications
You must be signed in to change notification settings - Fork 2
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
refactor: add Validate()
and Check()
#186
Conversation
Warning Rate limit exceeded@zyy17 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 24 minutes and 57 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe changes introduce a new validation mechanism for Changes
Possibly related PRs
Suggested reviewers
Poem
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
CodeRabbit Configuration File (
|
3f89849
to
1470b4e
Compare
Can you add a |
Signed-off-by: zyy17 <[email protected]>
1470b4e
to
0dd919e
Compare
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: 10
🧹 Outside diff range and nitpick comments (5)
controllers/greptimedbstandalone/controller.go (1)
112-115
: Add unit tests for theValidate()
andCheck()
methodsTo ensure the new
Validate()
andCheck()
methods function correctly and to prevent regressions, please add unit tests for these methods. This will improve code reliability and maintainability.Do you want me to help generate the unit tests or open a GitHub issue to track this task?
Also applies to: 117-120
controllers/greptimedbcluster/controller.go (3)
132-135
: Add unit tests forcluster.Validate()
.To ensure that the new
cluster.Validate()
method functions correctly under various conditions, please add unit tests that cover both successful validation and failure scenarios.Do you want me to help generate the unit tests or open a new GitHub issue to track this task?
137-140
: Add unit tests forcluster.Check()
.Similarly, please add unit tests for the
cluster.Check()
method to verify its correctness in different scenarios, including interactions with the Kubernetes client.Do you want me to help generate the unit tests or open a new GitHub issue to track this task?
132-140
: Ensure consistent error handling and logging.Both
cluster.Validate()
andcluster.Check()
methods return errors that are recorded as events. Consider enhancing the error messages or wrapping the errors with additional context to aid in debugging.apis/v1alpha1/validate.go (1)
262-263
: Correct the field name in error message for consistency.The error message refers to
storageSize
, but the method isGetSize()
. For consistency, consider changing the error message tosize is required in file storage
.Apply this diff to adjust the error message:
- return fmt.Errorf("storageSize is required in file storage") + return fmt.Errorf("size is required in file storage")
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
- apis/v1alpha1/validate.go (1 hunks)
- controllers/greptimedbcluster/controller.go (1 hunks)
- controllers/greptimedbstandalone/controller.go (1 hunks)
🔇 Additional comments (3)
apis/v1alpha1/validate.go (3)
254-255
: Use consistent field names in error messages.The error message refers to
name
, which aligns with the fieldGetName()
. Ensure that the terminology is consistent throughout the codebase for clarity.
258-259
: Use consistent field names in error messages.The error message mentions
mountPath
, while the method used isGetMountPath()
. This is consistent, but double-check to ensure that the field names match the expected configuration fields.
146-146
: Align error message with context for clarity.The error message could be more specific by indicating that it's the standalone TOML configuration that's invalid.
Refer to the previous suggestion made by daviderli614 to adjust the error message accordingly.
50f06b0
to
a1884d1
Compare
done |
a1884d1
to
495ec07
Compare
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
Summary by CodeRabbit
New Features
GreptimeDBCluster
andGreptimeDBStandalone
, ensuring configurations are correct and resources are available.Bug Fixes
Reconcile
method by logging warnings for invalid configurations.Refactor