Documentation
¶
Overview ¶
Package cachetest provides test doubles for the cache package. This package is intended for use in tests only.
Index ¶
- type MockPolicySource
- func (m *MockPolicySource) CopyPolicy(ctx context.Context, policyID, tag string, dst *ocistore.Store) (ocispec.Descriptor, error)
- func (m *MockPolicySource) DefinitionVersion(_ context.Context, policyID string) (string, string, error)
- func (m *MockPolicySource) SeedPolicy(policyID, version, digestStr string)
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
Click to show internal directories.
Click to hide internal directories.