Help us shape the future of Go! Take the 2026 Go Developer Survey

mock

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultNamespace = "default"

DefaultNamespace for mock deployments See deployer implementations for tests which ensure the currently active kube namespace is chosen when no explicit namespace is provided. This mock emulates a deployer which responds that the function was deployed to desired or previously-deployed ns or "default" if not defined.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	BuildInvoked bool
	BuildFn      func(fn.Function) error
}

func NewBuilder

func NewBuilder() *Builder

func (*Builder) Build

func (i *Builder) Build(ctx context.Context, f fn.Function, _ []fn.Platform) error

type Deployer

type Deployer struct {
	DeployInvoked bool
	DeployFn      func(context.Context, fn.Function) (fn.DeploymentResult, error)
}

func NewDeployer

func NewDeployer() *Deployer

func NewDeployerWithResult

func NewDeployerWithResult(result fn.DeploymentResult) *Deployer

NewDeployerWithResult is a convenience method for creating a mock deployer with a deploy function implementation which returns the given result and no error.

func (*Deployer) Deploy

func (i *Deployer) Deploy(ctx context.Context, f fn.Function) (fn.DeploymentResult, error)

type Describer

type Describer struct {
	DescribeInvoked bool
	DescribeFn      func(context.Context, string, string) (fn.Instance, error)
}

func NewDescriber

func NewDescriber() *Describer

func (*Describer) Describe

func (l *Describer) Describe(ctx context.Context, name, namespace string) (fn.Instance, error)

type Lister

type Lister struct {
	ListInvoked bool
	ListFn      func(context.Context, string) ([]fn.ListItem, error)
}

func NewLister

func NewLister() *Lister

func (*Lister) List

func (l *Lister) List(ctx context.Context, ns string) ([]fn.ListItem, error)

type MCPServer added in v0.48.0

type MCPServer struct {
	StartInvoked bool
	StartFn      func(context.Context) error
}

func NewMCPServer added in v0.48.0

func NewMCPServer() *MCPServer

func (*MCPServer) Start added in v0.48.0

func (s *MCPServer) Start(ctx context.Context) error

type PipelinesProvider

type PipelinesProvider struct {
	RunInvoked          bool
	RunFn               func(fn.Function) (string, fn.Function, error)
	RemoveInvoked       bool
	RemoveFn            func(fn.Function) error
	ConfigurePACInvoked bool
	ConfigurePACFn      func(fn.Function) error
	RemovePACInvoked    bool
	RemovePACFn         func(fn.Function) error
}

func NewPipelinesProvider

func NewPipelinesProvider() *PipelinesProvider

func (*PipelinesProvider) ConfigurePAC

func (p *PipelinesProvider) ConfigurePAC(ctx context.Context, f fn.Function, metadata any) error

func (*PipelinesProvider) Remove

func (p *PipelinesProvider) Remove(ctx context.Context, f fn.Function) error

func (*PipelinesProvider) RemovePAC

func (p *PipelinesProvider) RemovePAC(ctx context.Context, f fn.Function, metadata any) error

func (*PipelinesProvider) Run

type Pusher

type Pusher struct {
	PushInvoked bool
	PushFn      func(context.Context, fn.Function) (string, error)
}

func NewPusher

func NewPusher() *Pusher

func (*Pusher) Push

func (i *Pusher) Push(ctx context.Context, f fn.Function) (string, error)

type Remover

type Remover struct {
	RemoveInvoked bool
	RemoveFn      func(string, string) error
}

func NewRemover

func NewRemover() *Remover

func (*Remover) Remove

func (r *Remover) Remove(ctx context.Context, name, ns string) error

type Runner

type Runner struct {
	RunInvoked    bool
	RootRequested string
	RunFn         func(context.Context, fn.Function, string, time.Duration) (*fn.Job, error)
	sync.Mutex
}

Runner runs a function in a separate process, canceling it on context.Cancel. Immediately returned is the port of the running function.

func NewRunner

func NewRunner() *Runner

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, f fn.Function, addr string, t time.Duration) (*fn.Job, error)

Jump to

Keyboard shortcuts

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