Skip to content

remoteresolution git resolver: test cache coupling after LRU key fix #9597

@waveywaves

Description

@waveywaves

Description

The remoteresolution git resolver's Resolver.Initialize() method at pkg/remoteresolution/resolver/git/resolver.go has a if r.cache == nil guard that preserves the LRU cache across calls. Unlike the deprecated pkg/resolution/resolver/git/resolver.go which always creates a fresh cache in Initialize(), the remoteresolution version retains the existing cache.

This was masked when the cache key was a pointer type (*secretCacheKey) — pointer comparison used address equality, so every allocation was a unique key and the cache effectively never hit. After #9595 fixed the cache keys to use struct values, the cache started working correctly, which exposed test coupling: a test case that caches a secret value can affect subsequent test cases that look up the same secret name.

#9595 worked around this by using distinct secret names across test cases, but this is fragile.

Expected Behavior

Each test case should be isolated — cached values from one test should not affect another.

Proposed Fix

Either:

  1. Remove the if r.cache == nil guard so Initialize() always creates a fresh cache
  2. Create a new Resolver instance per test case

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/resolutionIssues related to remote resolutionkind/bugCategorizes issue or PR as related to a bug.

    Type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions