Documentation
¶
Overview ¶
Package testutil is shared fixture scaffolding for tests across the repo — kept minimal so each test file stays self-describing.
Index ¶
- func CopyTree(tb testing.TB, src, dst string)
- func CrossSourceOptionalInputs(tb testing.TB) [2]string
- func Declarations(productions []manifest.Production) []manifest.NamedResource
- func DecodeDocs(r io.Reader) ([]map[string]any, error)
- func DecodeRender(data []byte) ([]map[string]any, error)
- func DocumentMaps(docs []manifest.DocOccurrence) []map[string]any
- func DocumentOccurrences(docs []map[string]any) []manifest.DocOccurrence
- func EncodeRender(docs []map[string]any) ([]byte, error)
- func GitCommitAll(tb testing.TB, repo *git.Repository, message string, ...) plumbing.Hash
- func GitInit(tb testing.TB, dir string) *git.Repository
- func HelmReleaseID(namespace, name string) manifest.NamedResource
- func KustomizationID(namespace, name string) manifest.NamedResource
- func KustomizationYAML(name, namespace, spec string) string
- func ObjectDocument(obj manifest.BaseManifest) map[string]any
- func Owners(productions []manifest.Production) []manifest.NamedResource
- func ProductionEvidence(ids []manifest.NamedResource) []manifest.Production
- func RenderMaps(docs []manifest.DocOccurrence, receipt *manifest.RenderReceipt, err error) ([]map[string]any, *manifest.RenderReceipt, error)
- func SelfSignedCA(t *testing.T) string
- func SplitDocs(data []byte) ([]map[string]any, error)
- func StubDNS(t *testing.T, lookup func(context.Context, string) error)
- func TarGz(tb testing.TB, files map[string]string, mode int64, level int) []byte
- func WriteFile(tb testing.TB, root, rel, body string)
- func WriteFileAt(tb testing.TB, path, body string)
- func WriteFilteredOrderingCluster(tb testing.TB, root, greeting string, brokenSource bool)
- func WriteGeneratedValuesCluster(tb testing.TB, root string)
- func WriteSubstitutionProducerCluster(tb testing.TB, root, kind string)
- func WriteTar(tb testing.TB, dst io.Writer, files map[string]string, mode int64)
- func WriteTree(tb testing.TB, files map[string]string) string
- type Certificate
- type ChartRegistry
- type CountingStorer
- type GitReads
- type SparseGit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyTree ¶ added in v0.7.3
CopyTree copies src into dst using fixture directory and file modes.
func CrossSourceOptionalInputs ¶ added in v0.7.3
CrossSourceOptionalInputs creates identical bootstrap trees with distinct local selected-source histories.
func Declarations ¶ added in v0.7.3
func Declarations(productions []manifest.Production) []manifest.NamedResource
Declarations returns sorted unique declarations from borrowed production evidence.
func DecodeDocs ¶ added in v0.7.3
DecodeDocs constructs mapping fixtures and rejects retained failures.
func DecodeRender ¶ added in v0.7.3
DecodeRender projects constructed cache fixtures.
func DocumentMaps ¶ added in v0.7.3
func DocumentMaps(docs []manifest.DocOccurrence) []map[string]any
DocumentMaps projects attempted inventory for mapping assertions.
func DocumentOccurrences ¶ added in v0.7.3
func DocumentOccurrences(docs []map[string]any) []manifest.DocOccurrence
DocumentOccurrences assigns ordinals to mapping fixtures.
func EncodeRender ¶ added in v0.7.3
EncodeRender encodes ordered mapping fixtures.
func GitCommitAll ¶ added in v0.7.3
func GitCommitAll(tb testing.TB, repo *git.Repository, message string, options *git.CommitOptions) plumbing.Hash
GitCommitAll stages the entire worktree and commits it with the supplied options.
func GitInit ¶ added in v0.7.3
func GitInit(tb testing.TB, dir string) *git.Repository
GitInit initializes a Git repository at dir.
func HelmReleaseID ¶ added in v0.7.3
func HelmReleaseID(namespace, name string) manifest.NamedResource
HelmReleaseID returns the identity of a Flux HelmRelease.
func KustomizationID ¶ added in v0.7.3
func KustomizationID(namespace, name string) manifest.NamedResource
KustomizationID returns the identity of a Flux Kustomization.
func KustomizationYAML ¶ added in v0.7.3
KustomizationYAML wraps spec in a Flux Kustomization document.
func ObjectDocument ¶ added in v0.7.3
func ObjectDocument(obj manifest.BaseManifest) map[string]any
ObjectDocument retains data payloads when constructing authoritative SDK fixtures.
func Owners ¶ added in v0.7.3
func Owners(productions []manifest.Production) []manifest.NamedResource
Owners returns sorted unique owners from borrowed production evidence.
func ProductionEvidence ¶ added in v0.7.3
func ProductionEvidence(ids []manifest.NamedResource) []manifest.Production
ProductionEvidence supplies fixture ownership without authored coordinates.
func RenderMaps ¶ added in v0.7.3
func RenderMaps( docs []manifest.DocOccurrence, receipt *manifest.RenderReceipt, err error, ) ([]map[string]any, *manifest.RenderReceipt, error)
RenderMaps projects successful renderer outcomes for map assertions.
func SelfSignedCA ¶
SelfSignedCA returns a PEM-encoded CA certificate.
func StubDNS ¶ added in v0.7.3
StubDNS bypasses environment proxies and resolves fixture hosts to loopback or a lookup error. It changes process-global state, so callers MUST remain serial.
func WriteFile ¶
WriteFile writes body to root/rel, creating any missing parent directories. Fails the test on any I/O error.
Accepts testing.TB so benchmarks (*testing.B) can share the same fixture helper as unit tests (*testing.T) — fixture building is part of the bench's setup phase, not the measured loop.
func WriteFileAt ¶
WriteFileAt writes body to path (absolute or cwd-relative), creating any missing parent directories. Companion to WriteFile for callers that already hold a full path rather than a root+rel split.
func WriteFilteredOrderingCluster ¶ added in v0.7.3
WriteFilteredOrderingCluster applies required sources beside excluded controllers and sources.
func WriteGeneratedValuesCluster ¶ added in v0.7.3
WriteGeneratedValuesCluster creates two ordered releases using a generated values ConfigMap.
func WriteSubstitutionProducerCluster ¶ added in v0.7.3
WriteSubstitutionProducerCluster creates a generator whose rendered data differs from discovery.
Types ¶
type Certificate ¶ added in v0.7.3
type Certificate struct{ Cert, Key string }
Certificate keeps a PEM certificate with its matching private key.
func SelfSignedClientCert ¶
func SelfSignedClientCert(t *testing.T) Certificate
SelfSignedClientCert returns a PEM-encoded client cert and matching ECDSA private key — ExtKeyUsage is ClientAuth only.
func SelfSignedServerCert ¶
func SelfSignedServerCert(t *testing.T) Certificate
SelfSignedServerCert returns a PEM-encoded server+client cert and matching ECDSA private key — usable as both a TLS server cert and a CA bundle (IsCA=true).
type ChartRegistry ¶ added in v0.7.3
type ChartRegistry struct {
URL, Digest string
Authenticated atomic.Int64
Digests []string
TagGeneration atomic.Int64
Requests atomic.Uint64
}
ChartRegistry serves chart layers from an in-process TLS registry.
func NewChartRegistry ¶ added in v0.7.3
NewChartRegistry returns a local OCI registry with fixed chart contents.
type CountingStorer ¶ added in v0.7.3
CountingStorer preserves storage behavior while counting object Reader opens.
func (*CountingStorer) EncodedObject ¶ added in v0.7.3
func (s *CountingStorer) EncodedObject(kind plumbing.ObjectType, hash plumbing.Hash) (plumbing.EncodedObject, error)
EncodedObject wraps readers without changing their type, identity or bytes.
type GitReads ¶ added in v0.7.3
GitReads separates metadata Reader opens from blob Reader opens in one phase.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cachetest provides constructor-injected cache fixtures.
|
Package cachetest provides constructor-injected cache fixtures. |
|
Package controllertest drives controller fixtures through their task service.
|
Package controllertest drives controller fixtures through their task service. |
|
Package fetchtest preserves the two acquisition phases in source tests.
|
Package fetchtest preserves the two acquisition phases in source tests. |