testutils

package
v1.22.0-capdev.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 15 Imported by: ? 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ID added in v0.8.0

type ID string

type Namespace added in v0.8.0

type Namespace string

type Secrets added in v0.8.0

type Secrets map[Namespace]map[ID]string

type TestRuntime

type TestRuntime struct {
	sdkimpl.Runtime
	// contains filtered or unexported fields
}

TestRuntime is a Runtime implementation meant for use in unit tests. Note that it should always be constructed via NewRuntime.

func NewRuntime added in v0.5.0

func NewRuntime(tb testing.TB, secrets Secrets) *TestRuntime

NewRuntime creates a new TestRuntime for use in tests. Execution metadata defaults to zero/empty (not nil) values until SetExecutionMetadata is called. A nil Secrets map is treated as an empty map, but entries cannot be added later. The secrets map is used directly by the TestRuntime; changes to entries will be reflected in subsequent calls to GetSecret.

func (*TestRuntime) GetLogs

func (t *TestRuntime) GetLogs() [][]byte

GetLogs returns a copy of all logs written to the TestRuntime's logger.

func (*TestRuntime) SetExecutionMetadata

func (t *TestRuntime) SetExecutionMetadata(executionMetadata cre.WorkflowExecutionMetadata)

SetExecutionMetadata sets the workflow execution metadata exposed by all runtime modes.

func (*TestRuntime) SetNodeRandomSource

func (t *TestRuntime) SetNodeRandomSource(source rand.Source)

SetNodeRandomSource sets the random source used by the Node mode. Note that once the first random is called, changes will have no effect.

func (*TestRuntime) SetRandomSource

func (t *TestRuntime) SetRandomSource(source rand.Source)

SetRandomSource sets the random source used by the DON mode. Note that once the first random is called, changes will have no effect.

func (*TestRuntime) SetTimeProvider added in v1.1.3

func (t *TestRuntime) SetTimeProvider(timeProvider func() time.Time)

SetTimeProvider sets the time provider that will be used when Now is called on the Runtime

type TestTeeRuntime added in v1.18.0

type TestTeeRuntime struct {
	*TestRuntime
	*sdkimpl.TeeRuntime
}

TestTeeRuntime is a TeeRuntime implementation for use in unit tests. Note that it should always be constructed via NewTeeRuntime.

func NewTeeRuntime added in v1.18.0

func NewTeeRuntime(tb testing.TB, secrets Secrets) *TestTeeRuntime

NewTeeRuntime creates a new TestTeeRuntime for use in tests. A nil Secrets map is treated as an empty map, but entries cannot be added later.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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