Skip to content

fix: Fix test data generation and skip signature verification#839

Merged
kalbasit merged 2 commits intomainfrom
fix-test-data-generation-and-skip-signature-verification
Feb 11, 2026
Merged

fix: Fix test data generation and skip signature verification#839
kalbasit merged 2 commits intomainfrom
fix-test-data-generation-and-skip-signature-verification

Conversation

@kalbasit
Copy link
Owner

@kalbasit kalbasit commented Feb 11, 2026

Update GenerateEntry to create valid narinfo with proper References format.
Remove invalid fake signature since generated test entries cannot be signed
without the private key. Update distributed tests to skip public key
verification when using generated test entries.

Changes:

  • testdata/generator.go:

    • Remove invalid fake signature (test-cache:1:fakesignature==)
    • Update References field to format: narInfoHash-generated-test
    • Add comment explaining why signatures are not included
  • pkg/cache/cache_distributed_test.go:

    • Update all 4 distributed test functions to pass nil for upstream options
    • Tests affected: testDistributedDownloadDeduplication, testDistributedConcurrentReads,
      testLargeNARConcurrentDownloadScenario, testCDCProgressiveStreamingDuringChunking
    • Add comments explaining why public key verification is skipped

This fixes narinfo parsing failures in distributed tests where GetNar was unable
to fetch narinfo for generated test entries due to invalid format.

Part of #806

Co-Authored-By: Claude Haiku 4.5 noreply@anthropic.com

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Feb 11, 2026
@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 resolves issues in distributed tests by refining the generation and consumption of test data. It ensures that generated narinfo entries are correctly formatted, specifically the References field, and disables public key verification in relevant distributed tests. This prevents previous parsing failures and allows tests to execute successfully without requiring actual cryptographic signatures for synthetic data.

Highlights

  • Test Data Generation: Updated the GenerateEntry function to create valid narinfo with the correct References format and removed invalid fake signatures.
  • Signature Verification: Modified distributed tests to skip public key verification when using generated test entries, as these entries lack valid signatures.
  • Test Expectation Correction: Corrected a test expectation in pkg/cache/upstream/cache_test.go related to NAR hash format.
Changelog
  • pkg/cache/cache_distributed_test.go
    • Modified upstream.New calls in four distributed test functions (testDistributedDownloadDeduplication, testDistributedConcurrentReads, testLargeNARConcurrentDownloadScenario, testCDCProgressiveStreamingDuringChunking) to pass nil for upstream options, effectively disabling public key verification.
    • Added comments explaining why public key verification is skipped for generated test entries.
  • pkg/cache/upstream/cache_test.go
    • Refactored an assert.Equal call in TestGetNarInfo to use a named variable expectedURL for the expected NAR URL.
  • testdata/generator.go
    • Removed the Sig: test-cache:1:fakesignature== line from the generated narinfo text.
    • Updated the References field format to include a -generated-test suffix, using the narinfo hash as a self-reference.
    • Added comments explaining that generated entries do not include signatures and why public key verification should be skipped.
Activity
  • The pull request includes a co-authored commit by 'Claude Haiku 4.5', indicating collaboration or an AI-assisted commit.
  • The PR description mentions a commit message 'fix: Correct test expectation for non-prefixed NAR hash format', suggesting a multi-commit PR or a rebase.
  • The changes address and fix narinfo parsing failures in distributed tests where GetNar was unable to fetch narinfo due to invalid format.
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.

@dosubot dosubot bot added bug Something isn't working go Pull requests that update go code labels Feb 11, 2026
@dosubot
Copy link

dosubot bot commented Feb 11, 2026

Related Documentation

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

How did I do? Any feedback?  Join Discord

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 fixes test data generation for narinfo files by removing invalid signatures and correcting the References format. It also updates the distributed tests to skip signature verification, which is a necessary change.

My review includes one suggestion:
In testdata/generator.go, I've noted an inconsistency in the generated References field and suggested a change to make it align with the StorePath basename for a proper self-reference.

Overall, the changes are good and address the issue described. Addressing the feedback will further improve the code quality.

Comment on lines 33 to +40
narInfoText := fmt.Sprintf(`StorePath: %s
URL: %s
Compression: none
FileHash: sha256:%s
FileSize: %d
NarHash: sha256:%s
NarSize: %d
References: %s
Sig: test-cache:1:fakesignature==`,
References: %s-generated-test`,
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The generated References field seems inconsistent with the StorePath. The comment mentions using a self-reference, which typically means using the basename of the package's own store path.

The StorePath is .../<narInfoHash>-generated-test-package, so its basename is <narInfoHash>-generated-test-package.
However, the References field is being set to <narInfoHash>-generated-test.

To make this consistent, the References field should probably be <narInfoHash>-generated-test-package. This would make it a true self-reference to the store path's basename.

Suggested change
narInfoText := fmt.Sprintf(`StorePath: %s
URL: %s
Compression: none
FileHash: sha256:%s
FileSize: %d
NarHash: sha256:%s
NarSize: %d
References: %s
Sig: test-cache:1:fakesignature==`,
References: %s-generated-test`,
narInfoText := fmt.Sprintf(`StorePath: %s
URL: %s
Compression: none
FileHash: sha256:%s
FileSize: %d
NarHash: sha256:%s
NarSize: %d
References: %s-generated-test-package`,

@kalbasit kalbasit force-pushed the improve-nar-file-serving-remove-old-url-prefix-workaround branch from 372be8b to 3d6c7ca Compare February 11, 2026 17:14
@kalbasit kalbasit force-pushed the fix-test-data-generation-and-skip-signature-verification branch from 10922cb to 3d1a78d Compare February 11, 2026 17:14
@kalbasit kalbasit force-pushed the improve-nar-file-serving-remove-old-url-prefix-workaround branch from 3d6c7ca to 6b35b08 Compare February 11, 2026 17:45
@kalbasit kalbasit force-pushed the fix-test-data-generation-and-skip-signature-verification branch from 3d1a78d to 6cde063 Compare February 11, 2026 17:45
@kalbasit kalbasit force-pushed the improve-nar-file-serving-remove-old-url-prefix-workaround branch from 6b35b08 to 4a589ea Compare February 11, 2026 17:49
@kalbasit kalbasit force-pushed the fix-test-data-generation-and-skip-signature-verification branch 2 times, most recently from 6ffbcd0 to b226ff0 Compare February 11, 2026 18:37
@kalbasit kalbasit force-pushed the improve-nar-file-serving-remove-old-url-prefix-workaround branch from 4a589ea to 44963b2 Compare February 11, 2026 18:37
Base automatically changed from improve-nar-file-serving-remove-old-url-prefix-workaround to main February 11, 2026 19:11
kalbasit and others added 2 commits February 11, 2026 11:12
Update GenerateEntry to create valid narinfo with proper References format.
Remove invalid fake signature since generated test entries cannot be signed
without the private key. Update distributed tests to skip public key
verification when using generated test entries.

Changes:
- testdata/generator.go:
  - Remove invalid fake signature (test-cache:1:fakesignature==)
  - Update References field to format: narInfoHash-generated-test
  - Add comment explaining why signatures are not included

- pkg/cache/cache_distributed_test.go:
  - Update all 4 distributed test functions to pass nil for upstream options
  - Tests affected: testDistributedDownloadDeduplication, testDistributedConcurrentReads,
    testLargeNARConcurrentDownloadScenario, testCDCProgressiveStreamingDuringChunking
  - Add comments explaining why public key verification is skipped

This fixes narinfo parsing failures in distributed tests where GetNar was unable
to fetch narinfo for generated test entries due to invalid format.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@kalbasit kalbasit force-pushed the fix-test-data-generation-and-skip-signature-verification branch from b226ff0 to ebe277b Compare February 11, 2026 19:15
@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

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

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #839   +/-   ##
=======================================
  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 6bca857 into main Feb 11, 2026
16 checks passed
@kalbasit kalbasit deleted the fix-test-data-generation-and-skip-signature-verification branch February 11, 2026 19:29
kalbasit added a commit that referenced this pull request Feb 12, 2026
Update GenerateEntry to create valid narinfo with proper References format.
Remove invalid fake signature since generated test entries cannot be signed
without the private key. Update distributed tests to skip public key
verification when using generated test entries.

Changes:
- testdata/generator.go:
  - Remove invalid fake signature (test-cache:1:fakesignature==)
  - Update References field to format: narInfoHash-generated-test
  - Add comment explaining why signatures are not included

- pkg/cache/cache_distributed_test.go:
  - Update all 4 distributed test functions to pass nil for upstream options
  - Tests affected: testDistributedDownloadDeduplication, testDistributedConcurrentReads,
    testLargeNARConcurrentDownloadScenario, testCDCProgressiveStreamingDuringChunking
  - Add comments explaining why public key verification is skipped

This fixes narinfo parsing failures in distributed tests where GetNar was unable
to fetch narinfo for generated test entries due to invalid format.

Part of #806

---------

Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
(cherry picked from commit 6bca857)
kalbasit added a commit that referenced this pull request Feb 12, 2026
Update GenerateEntry to create valid narinfo with proper References format.
Remove invalid fake signature since generated test entries cannot be signed
without the private key. Update distributed tests to skip public key
verification when using generated test entries.

Changes:
- testdata/generator.go:
  - Remove invalid fake signature (test-cache:1:fakesignature==)
  - Update References field to format: narInfoHash-generated-test
  - Add comment explaining why signatures are not included

- pkg/cache/cache_distributed_test.go:
  - Update all 4 distributed test functions to pass nil for upstream options
  - Tests affected: testDistributedDownloadDeduplication, testDistributedConcurrentReads,
    testLargeNARConcurrentDownloadScenario, testCDCProgressiveStreamingDuringChunking
  - Add comments explaining why public key verification is skipped

This fixes narinfo parsing failures in distributed tests where GetNar was unable
to fetch narinfo for generated test entries due to invalid format.

Part of #806

---------

Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
(cherry picked from commit 6bca857)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working 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