testutil

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package testutil holds shared fakes and helpers for tests that exercise the controller package. Importable from any test package without dragging in the controller package's own test fixtures.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeBroker

type FakeBroker struct {
	Values map[string]string                  // credential name → value
	Errs   map[string]error                   // credential name → fatal error
	Meta   map[string]brokerapi.IssueResponse // credential name → response metadata override

	Calls       int
	RevokeCalls []RevokeCall
	RevokeErr   error // when set, Revoke returns this for every call
	// contains filtered or unexported fields
}

FakeBroker is an in-memory BrokerIssuer for reconciler tests. Satisfies the controller.BrokerIssuer interface — the controller package's tests construct it as `&FakeBroker{Values: ...}` and inject it into HarnessRunReconciler.BrokerClient.

Concurrency: Issue and Revoke are safe to call from multiple goroutines (mutable fields are guarded by mu).

func (*FakeBroker) Issue

func (f *FakeBroker) Issue(_ context.Context, _ string, _ string, credentialName string) (*brokerapi.IssueResponse, error)

Issue implements controller.BrokerIssuer.

func (*FakeBroker) Revoke

func (f *FakeBroker) Revoke(_ context.Context, runName, runNamespace string, lease paddockv1alpha1.IssuedLease) error

Revoke implements controller.BrokerIssuer. Records every call so tests can assert against the sequence of revokes the reconciler makes.

type RevokeCall

type RevokeCall struct {
	RunName, RunNamespace string
	Lease                 paddockv1alpha1.IssuedLease
}

RevokeCall records one Revoke invocation for inspection in tests.

Jump to

Keyboard shortcuts

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