Skip to content

test: Ensure all NAR entries are tested in the upstream test#822

Merged
kalbasit merged 3 commits intomainfrom
02-09-chore_ensure_all_nars_are_tested
Feb 10, 2026
Merged

test: Ensure all NAR entries are tested in the upstream test#822
kalbasit merged 3 commits intomainfrom
02-09-chore_ensure_all_nars_are_tested

Conversation

@kalbasit
Copy link
Owner

The calls to GetNarInfo and GetNar in the upstream package should
exercise all NAR entries.

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. go Pull requests that update go code labels Feb 10, 2026
@dosubot
Copy link

dosubot bot commented Feb 10, 2026

Related Documentation

Checked 7 published document(s) in 1 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @kalbasit, 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 significantly improves the test suite for the upstream cache package by ensuring that GetNarInfo and GetNar functions are thoroughly tested against all available NAR entries. This change enhances the robustness and reliability of the cache's interaction with NAR data by covering a broader range of scenarios and adding a new test data entry.

Highlights

  • Enhanced Test Coverage for GetNarInfo: The TestGetNarInfo function has been updated to iterate through all defined NAR entries in testdata.Entries, ensuring comprehensive validation of NAR information retrieval.
  • Expanded Test Coverage for GetNar: The TestGetNar function now also iterates over all testdata.Entries, significantly broadening the test cases for NAR retrieval and ensuring robustness.
  • New Test Data Entry Added: A new NAR entry, Nar7, has been introduced in the testdata package to further diversify and strengthen the test suite.
Changelog
  • pkg/cache/upstream/cache_test.go
    • Imported the strconv package.
    • Refactored TestGetNarInfo to use a loop over testdata.Entries, replacing a single test case.
    • Modified TestGetNarInfo assertions to dynamically check NarSize or FileSize based on the NarInfoHash.
    • Refactored TestGetNar to use a loop over testdata.Entries, replacing a single test case.
    • Added t.Parallel() calls to the TestGetNar subtests for concurrent execution.
    • Updated the Content-Length assertion in TestGetNar to use strconv.Itoa(len(narEntry.NarText)) for dynamic content length verification.
  • testdata/entries.go
    • Appended Nar7 to the Entries slice.
  • testdata/nar7.go
    • Added a new file defining Nar7, including its NarInfoHash, NarInfoPath, NarInfoText, NarHash, NarCompression, NarPath, and NarText.
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 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 counter productive. 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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

Copy link
Owner Author

kalbasit commented Feb 10, 2026

Copy link
Contributor

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

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 enhances test coverage by ensuring all NAR entries are exercised in the upstream package tests. The changes are a good step forward. I've identified a potential issue in a test assertion and an inefficiency where a test is run multiple times within a loop. My review comments include suggestions to address these points.

@kalbasit kalbasit force-pushed the 02-09-chore_ensure_all_nars_are_tested branch from 3bbb1c3 to 7059d12 Compare February 10, 2026 05:10
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Feb 10, 2026
Base automatically changed from refactor-nar-narinfo-helper-packages to main February 10, 2026 05:22
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Feb 10, 2026
The calls to GetNarInfo and GetNar in the upstream package should
exercise all NAR entries.
@kalbasit kalbasit force-pushed the 02-09-chore_ensure_all_nars_are_tested branch from dc3bf87 to 4eefef7 Compare February 10, 2026 05:24
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Feb 10, 2026
@kalbasit kalbasit enabled auto-merge (squash) February 10, 2026 05:25
@kalbasit kalbasit added the backport release-0.8 Backport PR automatically label Feb 10, 2026
@kalbasit kalbasit disabled auto-merge February 10, 2026 05:32
@codecov
Copy link

codecov bot commented Feb 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.41%. Comparing base (f1a1479) to head (4eefef7).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #822   +/-   ##
=======================================
  Coverage   85.41%   85.41%           
=======================================
  Files           2        2           
  Lines         480      480           
=======================================
  Hits          410      410           
  Misses         65       65           
  Partials        5        5           

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

@kalbasit kalbasit merged commit 03c5667 into main Feb 10, 2026
18 checks passed
@kalbasit kalbasit deleted the 02-09-chore_ensure_all_nars_are_tested branch February 10, 2026 05:48
@kalbasit
Copy link
Owner Author

Backport failed for release-0.8, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin release-0.8
git worktree add -d .worktree/backport-822-to-release-0.8 origin/release-0.8
cd .worktree/backport-822-to-release-0.8
git switch --create backport-822-to-release-0.8
git cherry-pick -x d227006382fe9ce2421ff4590e4f2c5aa383006e 5fd2547f7a13dfb17efdc8b26c25bbda5e2c8750 4eefef7b3b97dd8680b00cb805ab4eae79b5a110

kalbasit added a commit that referenced this pull request Feb 10, 2026
The calls to GetNarInfo and GetNar in the upstream package should
exercise all NAR entries.

(cherry picked from commit 03c5667)
kalbasit added a commit that referenced this pull request Feb 10, 2026
…#822] (#827)

The calls to GetNarInfo and GetNar in the upstream package should
exercise all NAR entries.

(cherry picked from commit 03c5667)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport release-0.8 Backport PR automatically go Pull requests that update go code size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant