mock

package
v0.37.1 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 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 that defined on the function, 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) error

type Client

type Client struct {
	// Members used to confirm certain configuration was used for instantiation
	// (roughly map to the real clients WithX functions)
	Confirm          bool
	RepositoriesPath string
	// contains filtered or unexported fields
}

func NewClient

func NewClient() *Client

func (*Client) Repositories

func (c *Client) Repositories() *Repositories

type DNSProvider

type DNSProvider struct {
	ProvideInvoked   bool
	NameRequested    string
	AddressRequested string
}

func NewDNSProvider

func NewDNSProvider() *DNSProvider

func (*DNSProvider) Provide

func (d *DNSProvider) Provide(name, address string) string

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(string) (fn.Instance, error)
}

func NewDescriber

func NewDescriber() *Describer

func (*Describer) Describe

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

type Initializer

type Initializer struct {
	SupportedRuntimes []string
	InitializeInvoked bool
	InitializeFn      func(runtime, template, path string) error
}

func NewInitializer

func NewInitializer() *Initializer

func (*Initializer) Initialize

func (i *Initializer) Initialize(runtime, template, path string) error

type Lister

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

func NewLister

func NewLister() *Lister

func (*Lister) List

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

type PipelinesProvider

type PipelinesProvider struct {
	RunInvoked          bool
	RunFn               func(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(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) error
}

func NewRemover

func NewRemover() *Remover

func (*Remover) Remove

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

type Repositories

type Repositories struct {
	// Members which record whether or not the various methods were invoked.
	ListInvoked bool
	// contains filtered or unexported fields
}

func NewRepositories

func NewRepositories() *Repositories

func (*Repositories) Add

func (r *Repositories) Add(name, url string) (string, error)

func (*Repositories) All

func (r *Repositories) All() ([]fn.Repository, error)

func (*Repositories) List

func (r *Repositories) List() ([]string, error)

func (*Repositories) Remove

func (r *Repositories) Remove(name string) error

func (*Repositories) Rename

func (r *Repositories) Rename(old, new string) error

type Runner

type Runner struct {
	RunInvoked    bool
	RootRequested string
	RunFn         func(context.Context, fn.Function) (*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) (*fn.Job, error)

Jump to

Keyboard shortcuts

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