Skip to content

feat(Refactor): Migrate cache metadata and lru tests to testify#4821

Merged
charith87 merged 1 commit into
masterfrom
charithc_changes_go_5
Jun 30, 2026
Merged

feat(Refactor): Migrate cache metadata and lru tests to testify#4821
charith87 merged 1 commit into
masterfrom
charithc_changes_go_5

Conversation

@charith87

@charith87 charith87 commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

Helps in standard IDE integration, moving away from unmaintained library, and unifying testing styles.
b/529247072

@charith87

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread internal/cache/lru/lru_test.go Outdated
@charith87
charith87 force-pushed the charithc_changes_go_5 branch from fff1e03 to 1890cdd Compare June 28, 2026 03:48
@charith87
charith87 requested review from meet2mky and raj-prince June 28, 2026 03:54
@charith87
charith87 marked this pull request as ready for review June 28, 2026 03:54
@charith87
charith87 requested a review from a team as a code owner June 28, 2026 03:54
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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

  • Test Framework Migration: Migrated tests from the unmaintained 'ogletest' library to the standard 'testify' framework.
  • Code Cleanup: Removed boilerplate test structures and replaced them with standard Go testing functions and helper methods.
  • IDE Integration: Improved compatibility with standard IDE test runners by adopting the 'testify' testing style.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions github-actions Bot added the remind-reviewers Auto remind reviewers in attention set for review post 24hrs of inactivity on PR. label Jun 28, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread internal/cache/lru/lru_test.go Outdated
Comment thread internal/cache/lru/lru_test.go Outdated
Comment thread internal/cache/lru/lru_test.go Outdated
Comment thread internal/cache/metadata/type_cache_test.go Outdated
@charith87
charith87 force-pushed the charithc_changes_go_5 branch from 1890cdd to ec7ac47 Compare June 28, 2026 04:04
@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.66%. Comparing base (c1d09c9) to head (afc3817).

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     
Flag Coverage Δ
unittests 83.66% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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.

@github-actions

Copy link
Copy Markdown

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!

Comment thread internal/cache/lru/lru_test.go Outdated
@meet2mky

Copy link
Copy Markdown
Collaborator

@charith87, Can you also check other gemini comments.

Helps in standard IDE integration, moving away from unmaintained library, and unifying testing styles.
@charith87
charith87 force-pushed the charithc_changes_go_5 branch from ec7ac47 to afc3817 Compare June 29, 2026 05:31
@charith87

Copy link
Copy Markdown
Collaborator Author

@charith87, Can you also check other gemini comments.

Done

@charith87
charith87 requested a review from meet2mky June 29, 2026 06:21
@meet2mky

Copy link
Copy Markdown
Collaborator

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread internal/cache/lru/lru_test.go
Comment thread internal/cache/metadata/type_cache_test.go

@meet2mky meet2mky left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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 meet2mky left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit: please consider adding a bug in the description if you have it.

@charith87

Copy link
Copy Markdown
Collaborator Author

Nit: please consider adding a bug in the description if you have it.

Added

@charith87

Copy link
Copy Markdown
Collaborator Author

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.

Yea its finding a lot of them older ones. Will take it in a followup PR.

@raj-prince raj-prince left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Relying on Mohit's review.

@charith87
charith87 merged commit 72bdd84 into master Jun 30, 2026
20 checks passed
raj-prince pushed a commit that referenced this pull request Jul 1, 2026
Helps in standard IDE integration, moving away from unmaintained library, and unifying testing styles.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

remind-reviewers Auto remind reviewers in attention set for review post 24hrs of inactivity on PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants