Skip to content

Remove duplicate tests across resolver types and refactor to reduce redundancy #9113

@waveywaves

Description

@waveywaves

Context

In PR #9051, we added comprehensive E2E tests for the shared resolver cache across bundle, git, and cluster resolvers. However, there is significant duplication in test patterns across these resolver types.

Task

Refactor the E2E tests in test/resolver_cache_test.go to reduce redundancy while maintaining coverage.

Current State

The test file contains 15 tests, many of which follow similar patterns:

  • TestBundleResolverCache
  • TestBundleResolverCacheEviction
  • TestBundleResolverCacheTTL
  • TestGitResolverCache
  • TestGitResolverCacheEviction
  • TestGitResolverCacheTTL
  • TestClusterResolverCache
  • TestClusterResolverCacheEviction
  • TestClusterResolverCacheTTL

Proposed Solution

  • Extract common test patterns into helper functions
  • Consider table-driven tests that can test all resolver types with the same logic
  • Maintain full coverage while reducing code duplication
  • Keep resolver-specific tests only where behavior actually differs

Files to Modify

  • test/resolver_cache_test.go

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions