testutil

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package testutil is shared fixture scaffolding for tests across the repo — kept minimal so each test file stays self-describing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DepRefs

func DepRefs(ids ...manifest.NamedResource) []manifest.DependencyRef

DepRefs wraps NamedResources as bare DependencyRefs (no ReadyExpr), the shape dependency-ordering tests use to express dependsOn edges.

func SelfSignedCA

func SelfSignedCA(t *testing.T) string

SelfSignedCA returns a PEM-encoded CA certificate.

func SelfSignedClientCert

func SelfSignedClientCert(t *testing.T) (cert, key string)

SelfSignedClientCert returns a PEM-encoded client cert and matching ECDSA private key — ExtKeyUsage is ClientAuth only.

func SelfSignedServerCert

func SelfSignedServerCert(t *testing.T) (cert, key string)

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).

func WriteFile

func WriteFile(t testing.TB, root, rel, body string)

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

func WriteFileAt(t testing.TB, path, body string)

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.

Types

type MapLister

MapLister is a test fixture that implements change.ObjectLister via a plain map. Used by controller tests that need a minimal ObjectLister (typically an empty one) to construct a change.Filter.

func EmptyLister

func EmptyLister() MapLister

EmptyLister returns a MapLister with no entries — a minimal non-nil ObjectLister for tests that only need to construct a change.Filter.

func (MapLister) GetObject

GetObject returns the manifest stored under id, or nil if absent.

func (MapLister) ListObjects

func (m MapLister) ListObjects(kind string) []manifest.BaseManifest

ListObjects returns all manifests whose kind matches the given string.

Jump to

Keyboard shortcuts

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