testhooks

package
v1.30.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Call

func Call(_ TestHooks, _ Key)

Call calls a func() hook if present.

TestHooks should be used very sparingly, see comment on TestHooks.

func Get

func Get[T any](_ TestHooks, _ Key) (T, bool)

Get gets the value of a test hook. In production mode it always returns the zero value and false, which hopefully the compiler will inline and remove the hook as dead code.

TestHooks should be used very sparingly, see comment on TestHooks.

func Set added in v1.30.0

func Set[T any](_ TestHooks, _ Key, _ T) func()

Set is only to be used by test code together with the test_dep build tag.

Types

type Key

type Key int
const (
	MatchingDisableSyncMatch Key = iota
	MatchingLBForceReadPartition
	MatchingLBForceWritePartition
	UpdateWithStartInBetweenLockAndStart
	UpdateWithStartOnClosingWorkflowRetry
	TaskQueuesInDeploymentSyncBatchSize
	MatchingIgnoreRoutingConfigRevisionCheck
	MatchingDeploymentRegisterErrorBackoff
)

type TestHooks

type TestHooks struct{}

TestHooks (in production mode) is an empty struct just so the build works. See TestHooks in test_impl.go.

TestHooks are an inherently unclean way of writing tests. They require mixing test-only concerns into production code. In general you should prefer other ways of writing tests wherever possible, and only use TestHooks sparingly, as a last resort.

func NewTestHooks added in v1.30.0

func NewTestHooks() TestHooks

Jump to

Keyboard shortcuts

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