diff --git a/pkg/cache/cache_distributed_test.go b/pkg/cache/cache_distributed_test.go index 1934d295..16e0f67e 100644 --- a/pkg/cache/cache_distributed_test.go +++ b/pkg/cache/cache_distributed_test.go @@ -223,9 +223,9 @@ func testDistributedDownloadDeduplication(factory distributedDBFactory) func(*te require.NoError(t, err) // Create separate upstream cache for each instance to avoid data races - uc, err := upstream.New(ctx, testhelper.MustParseURL(t, ts.URL), &upstream.Options{ - PublicKeys: testdata.PublicKeys(), - }) + uc, err := upstream.New(ctx, testhelper.MustParseURL(t, ts.URL), nil) + // Don't use public keys for distributed tests with generated entries + // since they don't have valid signatures (we don't have the private key to sign them) require.NoError(t, err) c, err := cache.New( @@ -323,9 +323,9 @@ func testDistributedConcurrentReads(factory distributedDBFactory) func(*testing. t.Cleanup(ts.Close) // Create upstream cache - uc, err := upstream.New(ctx, testhelper.MustParseURL(t, ts.URL), &upstream.Options{ - PublicKeys: testdata.PublicKeys(), - }) + uc, err := upstream.New(ctx, testhelper.MustParseURL(t, ts.URL), nil) + // Don't use public keys for distributed tests with generated entries + // since they don't have valid signatures (we don't have the private key to sign them) require.NoError(t, err) // Create shared storage @@ -742,9 +742,9 @@ func testLargeNARConcurrentDownloadScenario(t *testing.T, factory distributedDBF cacheLocker, err := redis.NewRWLocker(ctx, redisCfg, retryCfg, false) require.NoError(t, err) - uc, err := upstream.New(ctx, testhelper.MustParseURL(t, ts.URL), &upstream.Options{ - PublicKeys: testdata.PublicKeys(), - }) + uc, err := upstream.New(ctx, testhelper.MustParseURL(t, ts.URL), nil) + // Don't use public keys for distributed tests with generated entries + // since they don't have valid signatures (we don't have the private key to sign them) require.NoError(t, err) c, err := cache.New( @@ -982,9 +982,9 @@ func testCDCProgressiveStreamingDuringChunking(factory distributedDBFactory) fun require.NoError(t, err) // Create separate upstream cache for each instance to avoid data races - uc, err := upstream.New(ctx, testhelper.MustParseURL(t, ts.URL), &upstream.Options{ - PublicKeys: testdata.PublicKeys(), - }) + uc, err := upstream.New(ctx, testhelper.MustParseURL(t, ts.URL), nil) + // Don't use public keys for distributed tests with generated entries + // since they don't have valid signatures (we don't have the private key to sign them) require.NoError(t, err) c, err := cache.New( diff --git a/pkg/cache/upstream/cache_test.go b/pkg/cache/upstream/cache_test.go index f46d6e89..5208d945 100644 --- a/pkg/cache/upstream/cache_test.go +++ b/pkg/cache/upstream/cache_test.go @@ -182,7 +182,8 @@ func TestGetNarInfo(t *testing.T) { ni, err := c.GetNarInfo(context.Background(), narEntry.NarInfoHash) require.NoError(t, err) - assert.Equal(t, "nar/09xizkfyvigl5fqs0dhkn46nghfwwijbpdzzl4zg6kx90prjmsg0.nar", ni.URL) + expectedURL := "nar/09xizkfyvigl5fqs0dhkn46nghfwwijbpdzzl4zg6kx90prjmsg0.nar" + assert.Equal(t, expectedURL, ni.URL) }) } }) diff --git a/testdata/generator.go b/testdata/generator.go index 1e00722a..eeb63f50 100644 --- a/testdata/generator.go +++ b/testdata/generator.go @@ -27,6 +27,9 @@ func GenerateEntry(t *testing.T, narData []byte) (Entry, error) { // Create narinfo text (using uncompressed NAR for simplicity in testing) narURL := fmt.Sprintf("nar/%s.nar", narHash) + // Note: Generated entries do not include signatures since we don't have the private key. + // Tests using these entries should not use public key verification. + // Use the narinfo hash as a self-reference since this is a generated test package with no dependencies. narInfoText := fmt.Sprintf(`StorePath: %s URL: %s Compression: none @@ -34,8 +37,7 @@ FileHash: sha256:%s FileSize: %d NarHash: sha256:%s NarSize: %d -References: %s -Sig: test-cache:1:fakesignature==`, +References: %s-generated-test`, storePath, narURL, narHash,