feat(Refactor): Migrate cache metadata and lru tests to testify#4821
Conversation
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the tests in internal/cache/lru/lru_test.go and internal/cache/metadata/type_cache_test.go to migrate from the ogletest framework to the standard Go testing package using testify/assert and testify/require. Feedback points out that require.NoError is incorrectly used inside a separate goroutine in TestRaceCondition, which can cause issues since FailNow must be called from the main test goroutine; using assert.NoError is recommended instead.
fff1e03 to
1890cdd
Compare
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request migrates the cache metadata and LRU tests from the 'ogletest' library to 'testify'. This change improves maintainability, aligns the testing style with standard Go practices, and enhances compatibility with IDE test runners. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors the test suites in internal/cache/lru/lru_test.go and internal/cache/metadata/type_cache_test.go to migrate from the ogletest framework to the standard testify library. The reviewer's feedback is highly constructive, pointing out several opportunities to make the assertions more idiomatic. Specifically, they recommend using require.ErrorIs and assert.ErrorIs for cleaner error assertions, and using assert.Nil/assert.NotNil instead of evaluating boolean equality.
1890cdd to
ec7ac47
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4821 +/- ##
==========================================
+ Coverage 83.64% 83.66% +0.01%
==========================================
Files 168 168
Lines 20848 20848
==========================================
+ Hits 17439 17443 +4
+ Misses 2757 2754 -3
+ Partials 652 651 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Hi @raj-prince, @meet2mky, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you! |
|
@charith87, Can you also check other gemini comments. |
Helps in standard IDE integration, moving away from unmaintained library, and unifying testing styles.
ec7ac47 to
afc3817
Compare
Done |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request migrates the test suites in internal/cache/lru/lru_test.go and internal/cache/metadata/type_cache_test.go from the ogletest framework to the standard Go testing package using testify/assert and testify/require. The reviewer's feedback is highly constructive, suggesting the use of require.NoError instead of require.ErrorIs when expecting a nil error in insertAndAssert, and recommending the use of t.Run for table-driven tests in TestTypeCache_New to isolate test cases.
meet2mky
left a comment
There was a problem hiding this comment.
I think gemini is finding issues in the existing code which is unrelated to the refactoring. I will let you decide if you want to address it or leave it as it is.
meet2mky
left a comment
There was a problem hiding this comment.
Nit: please consider adding a bug in the description if you have it.
Added |
Yea its finding a lot of them older ones. Will take it in a followup PR. |
raj-prince
left a comment
There was a problem hiding this comment.
Relying on Mohit's review.
Helps in standard IDE integration, moving away from unmaintained library, and unifying testing styles.
Helps in standard IDE integration, moving away from unmaintained library, and unifying testing styles.
b/529247072