fake

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2021 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Overview

Package fake implements a fake RuntimeFactory, useful in tests for mocking out certain components.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(ctx *context.T) (v23.Runtime, *context.T, v23.Shutdown, error)

func InjectRuntime

func InjectRuntime(runtime v23.Runtime, ctx *context.T, shutdown v23.Shutdown)

InjectRuntime allows packages to inject whichever runtime, ctx, and shutdown. This allows a package that needs different runtimes in tests to swap them as needed. The injected runtime will be valid until the shutdown returned from v23.Init is called.

func SetClientFactory

func SetClientFactory(ctx *context.T, factory func(ctx *context.T, opts ...rpc.ClientOpt) rpc.Client) *context.T

SetClientFactory can be used to inject a mock Client implementation into the context. When v23.WithNewClient is called passed function will be invoked.

func SetFlowManagerFactory

func SetFlowManagerFactory(ctx *context.T, factory func(ctx *context.T, channelTimeout time.Duration) flow.Manager) *context.T

SetFlowManagerFactory can be used to inject a mock FlowManager implementation into the context. When v23.NewFlowManager is called passed function will be invoked.

func SetServerFactory

func SetServerFactory(ctx *context.T, factory func(*context.T, string, interface{}, security.Authorizer, ...rpc.ServerOpt) (*context.T, rpc.Server)) *context.T

SetServerFactory can be used to inject a mock Server implementation into the context. When v23.WithNewServer is called the passed function will be invoked.

Types

type Runtime

type Runtime struct {
	// contains filtered or unexported fields
}

func (*Runtime) GetBackgroundContext

func (r *Runtime) GetBackgroundContext(ctx *context.T) *context.T

func (*Runtime) GetClient

func (r *Runtime) GetClient(ctx *context.T) rpc.Client

func (*Runtime) GetListenSpec

func (r *Runtime) GetListenSpec(ctx *context.T) rpc.ListenSpec

func (*Runtime) GetNamespace

func (r *Runtime) GetNamespace(ctx *context.T) namespace.T

func (*Runtime) GetPermissionsSpec

func (r *Runtime) GetPermissionsSpec(ctx *context.T) access.PermissionsSpec

func (*Runtime) GetPrincipal

func (r *Runtime) GetPrincipal(ctx *context.T) security.Principal

func (*Runtime) GetRequestID added in v0.1.14

func (r *Runtime) GetRequestID(ctx *context.T) uuid.UUID

func (*Runtime) GetReservedNameDispatcher

func (*Runtime) GetReservedNameDispatcher(ctx *context.T) rpc.Dispatcher

func (*Runtime) Init

func (r *Runtime) Init(ctx *context.T) error

func (*Runtime) NewDiscovery

func (r *Runtime) NewDiscovery(ctx *context.T) (discovery.T, error)

func (*Runtime) NewFlowManager

func (r *Runtime) NewFlowManager(ctx *context.T, channelTimeout time.Duration) (flow.Manager, error)

func (*Runtime) WithBackgroundContext

func (r *Runtime) WithBackgroundContext(ctx *context.T) *context.T

func (*Runtime) WithListenSpec

func (r *Runtime) WithListenSpec(ctx *context.T, ls rpc.ListenSpec) *context.T

func (*Runtime) WithNewClient

func (r *Runtime) WithNewClient(ctx *context.T, opts ...rpc.ClientOpt) (*context.T, rpc.Client, error)

func (*Runtime) WithNewDispatchingServer

func (r *Runtime) WithNewDispatchingServer(ctx *context.T, name string, disp rpc.Dispatcher, opts ...rpc.ServerOpt) (*context.T, rpc.Server, error)

func (*Runtime) WithNewNamespace

func (r *Runtime) WithNewNamespace(ctx *context.T, roots ...string) (*context.T, namespace.T, error)

func (*Runtime) WithNewServer

func (r *Runtime) WithNewServer(ctx *context.T, name string, object interface{}, auth security.Authorizer, opts ...rpc.ServerOpt) (*context.T, rpc.Server, error)

func (*Runtime) WithPrincipal

func (r *Runtime) WithPrincipal(ctx *context.T, principal security.Principal) (*context.T, error)

func (*Runtime) WithReservedNameDispatcher

func (*Runtime) WithReservedNameDispatcher(ctx *context.T, d rpc.Dispatcher) *context.T

Jump to

Keyboard shortcuts

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