contracttest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package contracttest contains reusable contract checks for secrets.Store implementations. It intentionally inspects only the public secrets API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertListMetadata

func AssertListMetadata(t *testing.T, lister secrets.Lister, namespace secrets.Namespace)

AssertListMetadata confirms that a lister does not expose a value field through the public metadata type and honors bounded pages.

func ErrorText

func ErrorText(err error) string

ErrorText is a helper for callers checking that an error remains bounded.

func RunList

func RunList(t *testing.T, lister secrets.Lister, config StoreContractOptions)

RunList exercises the optional metadata-only listing contract, including page boundaries and namespace isolation. Values are inserted by RunStore; this function only observes Metadata results.

func RunStore

func RunStore(t *testing.T, factory StoreFactory, options ...StoreContractOptions)

RunStore runs resolver/store behavior shared by local and future backends. Exactly one options value is required so this reusable runner cannot smuggle in a backend-specific reference or capability assumption.

Types

type ContractOptions

type ContractOptions = StoreContractOptions

ContractOptions is a short alias retained for adapters that use a generic contract-options name in their test harness.

type StoreContractConfig

type StoreContractConfig = StoreContractOptions

StoreContractConfig is a descriptive alias for callers that prefer the word “config” at the call site.

type StoreContractOptions

type StoreContractOptions struct {
	Reference        secrets.Reference
	Namespace        secrets.Namespace
	OtherReference   secrets.Reference
	OutsideReference secrets.Reference

	RequireCreateOnly     bool
	RequireCompareAndSwap bool
	RequireVersion        bool
	RequireListing        bool
}

StoreContractOptions identifies safe, backend-specific references used by the contract. The runner deliberately has no default scheme or path: each backend must provide references that it can actually resolve and list.

type StoreFactory

type StoreFactory func(t *testing.T) secrets.Store

StoreFactory constructs a fresh store for one contract run. The factory is responsible for registering cleanup with t.

Jump to

Keyboard shortcuts

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