cachetest

package
v1.0.0-alpha.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package cachetest provides test doubles for the cache package. This package is intended for use in tests only.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockPolicySource

type MockPolicySource struct {
	// contains filtered or unexported fields
}

MockPolicySource provides an in-memory mock for testing sync operations. Implements cache.PolicySource by pushing OCI content directly into the destination store.

func NewMockPolicySource

func NewMockPolicySource() *MockPolicySource

NewMockPolicySource creates a mock policy source for testing

func (*MockPolicySource) CopyPolicy

func (m *MockPolicySource) CopyPolicy(ctx context.Context, policyID, tag string, dst *ocistore.Store) (ocispec.Descriptor, error)

CopyPolicy pushes a minimal OCI manifest into the destination store for testing. Simulates what oras.Copy() does in production without needing a remote registry.

func (*MockPolicySource) DefinitionVersion

func (m *MockPolicySource) DefinitionVersion(_ context.Context, policyID string) (string, string, error)

DefinitionVersion returns digest and version for a mock policy

func (*MockPolicySource) SeedPolicy

func (m *MockPolicySource) SeedPolicy(policyID, version, digestStr string)

SeedPolicy adds a mock policy for testing

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL