Documentation
¶
Overview ¶
Package mock contains a minimal, mocked implementation of a fnenv for test purposes
Index ¶
- type Func
- type Resolver
- type Runtime
- func (mk *Runtime) Cancel(fnInvocationID string) error
- func (mk *Runtime) Invoke(spec *types.TaskInvocationSpec, opts ...fnenv.InvokeOption) (*types.TaskInvocationStatus, error)
- func (mk *Runtime) InvokeAsync(spec *types.TaskInvocationSpec, opts ...fnenv.InvokeOption) (string, error)
- func (mk *Runtime) MockComplete(fnInvocationID string) error
- func (mk *Runtime) Notify(taskID string, fn types.FnRef, expectedAt time.Time) error
- func (mk *Runtime) Status(fnInvocationID string) (*types.TaskInvocationStatus, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Func ¶
type Func func(spec *types.TaskInvocationSpec) (*typedvalues.TypedValue, error)
Func is the type for mocked functions used in the mock.Runtime
type Resolver ¶
Resolver is a mocked implementation of a RuntimeResolver.
Use FnNameIDs to setup a mapping to mock resolving function references to IDs.
func NewResolver ¶
func NewResolver() *Resolver
type Runtime ¶
type Runtime struct { Functions map[string]Func AsyncResults map[string]*types.TaskInvocation ManualExecution bool }
Runtime mocks the implementation of the various runtime.
Mock functions can be added to Functions, and should have the mocked function id as the key. For AsyncRuntime the results are stored and retrieved from the AsyncResults. The result is added automatically/instantly using the function, but can be avoided by enabling ManualExecution.
Note it does not mock the resolver, which is mocked by the mock.Resolver
func NewRuntime ¶
func NewRuntime() *Runtime
func (*Runtime) Invoke ¶
func (mk *Runtime) Invoke(spec *types.TaskInvocationSpec, opts ...fnenv.InvokeOption) (*types.TaskInvocationStatus, error)
func (*Runtime) InvokeAsync ¶
func (mk *Runtime) InvokeAsync(spec *types.TaskInvocationSpec, opts ...fnenv.InvokeOption) (string, error)