Documentation ¶
Overview ¶
Package fake implements a fake RuntimeFactory, useful in tests for mocking out certain components.
Index ¶
- func Init(ctx *context.T) (v23.Runtime, *context.T, v23.Shutdown, error)
- func InjectRuntime(runtime v23.Runtime, ctx *context.T, shutdown v23.Shutdown)
- func SetClientFactory(ctx *context.T, factory func(ctx *context.T, opts ...rpc.ClientOpt) rpc.Client) *context.T
- func SetFlowManagerFactory(ctx *context.T, ...) *context.T
- func SetServerFactory(ctx *context.T, ...) *context.T
- type Runtime
- func (r *Runtime) GetBackgroundContext(ctx *context.T) *context.T
- func (r *Runtime) GetClient(ctx *context.T) rpc.Client
- func (r *Runtime) GetListenSpec(ctx *context.T) rpc.ListenSpec
- func (r *Runtime) GetNamespace(ctx *context.T) namespace.T
- func (r *Runtime) GetPermissionsSpec(ctx *context.T) access.PermissionsSpec
- func (r *Runtime) GetPrincipal(ctx *context.T) security.Principal
- func (r *Runtime) GetRequestID(ctx *context.T) uuid.UUID
- func (*Runtime) GetReservedNameDispatcher(ctx *context.T) rpc.Dispatcher
- func (r *Runtime) Init(ctx *context.T) error
- func (r *Runtime) NewDiscovery(ctx *context.T) (discovery.T, error)
- func (r *Runtime) NewFlowManager(ctx *context.T, channelTimeout time.Duration) (flow.Manager, error)
- func (r *Runtime) WithBackgroundContext(ctx *context.T) *context.T
- func (r *Runtime) WithListenSpec(ctx *context.T, ls rpc.ListenSpec) *context.T
- func (r *Runtime) WithNewClient(ctx *context.T, opts ...rpc.ClientOpt) (*context.T, rpc.Client, error)
- func (r *Runtime) WithNewDispatchingServer(ctx *context.T, name string, disp rpc.Dispatcher, opts ...rpc.ServerOpt) (*context.T, rpc.Server, error)
- func (r *Runtime) WithNewNamespace(ctx *context.T, roots ...string) (*context.T, namespace.T, error)
- func (r *Runtime) WithNewServer(ctx *context.T, name string, object interface{}, auth security.Authorizer, ...) (*context.T, rpc.Server, error)
- func (r *Runtime) WithPrincipal(ctx *context.T, principal security.Principal) (*context.T, error)
- func (*Runtime) WithReservedNameDispatcher(ctx *context.T, d rpc.Dispatcher) *context.T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InjectRuntime ¶
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 (*Runtime) GetListenSpec ¶
func (r *Runtime) GetListenSpec(ctx *context.T) rpc.ListenSpec
func (*Runtime) GetPermissionsSpec ¶
func (r *Runtime) GetPermissionsSpec(ctx *context.T) access.PermissionsSpec
func (*Runtime) GetRequestID ¶ added in v0.1.14
func (*Runtime) GetReservedNameDispatcher ¶
func (*Runtime) GetReservedNameDispatcher(ctx *context.T) rpc.Dispatcher