provisiontest

package
v0.0.0-...-0cf49f2 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2015 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd struct {
	Cmd  string
	Args []string
	App  provision.App
}

type ExtensibleFakeProvisioner

type ExtensibleFakeProvisioner struct {
	*FakeProvisioner
	// contains filtered or unexported fields
}

func (*ExtensibleFakeProvisioner) GetPlatform

func (p *ExtensibleFakeProvisioner) GetPlatform(name string) *provisionedPlatform

func (*ExtensibleFakeProvisioner) PlatformAdd

func (*ExtensibleFakeProvisioner) PlatformRemove

func (p *ExtensibleFakeProvisioner) PlatformRemove(name string) error

func (*ExtensibleFakeProvisioner) PlatformUpdate

func (p *ExtensibleFakeProvisioner) PlatformUpdate(opts provision.PlatformOptions) error

type FakeApp

type FakeApp struct {
	Commands []string
	Memory   int64
	Swap     int64
	CpuShare int

	Deploys uint

	Pool           string
	UpdatePlatform bool
	TeamOwner      string
	Teams          []string
	quota.Quota
	// contains filtered or unexported fields
}

Fake implementation for provision.App.

func NewFakeApp

func NewFakeApp(name, platform string, units int) *FakeApp

func (*FakeApp) AddInstance

func (a *FakeApp) AddInstance(instanceApp bind.InstanceApp, w io.Writer) error

func (*FakeApp) AddUnit

func (a *FakeApp) AddUnit(u provision.Unit)

func (*FakeApp) BindUnit

func (a *FakeApp) BindUnit(unit *provision.Unit) error

func (*FakeApp) Envs

func (a *FakeApp) Envs() map[string]bind.EnvVar

Env returns app.Env

func (*FakeApp) GetCommands

func (a *FakeApp) GetCommands() []string

func (*FakeApp) GetCpuShare

func (a *FakeApp) GetCpuShare() int

func (*FakeApp) GetDeploys

func (a *FakeApp) GetDeploys() uint

func (*FakeApp) GetInstances

func (a *FakeApp) GetInstances(serviceName string) []bind.ServiceInstance

func (*FakeApp) GetIp

func (a *FakeApp) GetIp() string

func (*FakeApp) GetMemory

func (a *FakeApp) GetMemory() int64

func (*FakeApp) GetName

func (a *FakeApp) GetName() string

func (*FakeApp) GetPlatform

func (a *FakeApp) GetPlatform() string

func (*FakeApp) GetPool

func (a *FakeApp) GetPool() string

func (*FakeApp) GetQuota

func (a *FakeApp) GetQuota() quota.Quota

func (*FakeApp) GetRouter

func (app *FakeApp) GetRouter() (string, error)

func (*FakeApp) GetSwap

func (a *FakeApp) GetSwap() int64

func (*FakeApp) GetTeamOwner

func (app *FakeApp) GetTeamOwner() string

func (*FakeApp) GetTeamsName

func (app *FakeApp) GetTeamsName() []string

func (*FakeApp) GetUnits

func (a *FakeApp) GetUnits() ([]bind.Unit, error)

func (*FakeApp) GetUpdatePlatform

func (app *FakeApp) GetUpdatePlatform() bool

func (*FakeApp) HasBind

func (a *FakeApp) HasBind(unit *provision.Unit) bool

func (*FakeApp) HasLog

func (a *FakeApp) HasLog(source, unit, message string) bool

func (*FakeApp) InstanceEnv

func (a *FakeApp) InstanceEnv(env string) map[string]bind.EnvVar

func (*FakeApp) Log

func (a *FakeApp) Log(message, source, unit string) error

func (*FakeApp) Logs

func (a *FakeApp) Logs() []string

func (*FakeApp) RemoveInstance

func (a *FakeApp) RemoveInstance(instanceApp bind.InstanceApp, w io.Writer) error

func (*FakeApp) Run

func (a *FakeApp) Run(cmd string, w io.Writer, once bool) error

func (*FakeApp) SerializeEnvVars

func (a *FakeApp) SerializeEnvVars() error

func (*FakeApp) SetEnv

func (a *FakeApp) SetEnv(env bind.EnvVar)

func (*FakeApp) SetEnvs

func (a *FakeApp) SetEnvs(setEnvs bind.SetEnvApp, w io.Writer) error

func (*FakeApp) SetQuotaInUse

func (a *FakeApp) SetQuotaInUse(inUse int) error

func (*FakeApp) UnbindUnit

func (a *FakeApp) UnbindUnit(unit *provision.Unit) error

func (*FakeApp) Units

func (a *FakeApp) Units() ([]provision.Unit, error)

func (*FakeApp) UnsetEnvs

func (a *FakeApp) UnsetEnvs(unsetEnvs bind.UnsetEnvApp, w io.Writer) error

type FakeConn

type FakeConn struct {
	Buf *safe.Buffer
}

func (*FakeConn) Close

func (c *FakeConn) Close() error

func (*FakeConn) LocalAddr

func (c *FakeConn) LocalAddr() net.Addr

func (*FakeConn) Read

func (c *FakeConn) Read(b []byte) (int, error)

func (*FakeConn) RemoteAddr

func (c *FakeConn) RemoteAddr() net.Addr

func (*FakeConn) SetDeadline

func (c *FakeConn) SetDeadline(t time.Time) error

func (*FakeConn) SetReadDeadline

func (c *FakeConn) SetReadDeadline(t time.Time) error

func (*FakeConn) SetWriteDeadline

func (c *FakeConn) SetWriteDeadline(t time.Time) error

func (*FakeConn) Write

func (c *FakeConn) Write(b []byte) (int, error)

type FakeProvisioner

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

Fake implementation for provision.Provisioner.

func NewFakeProvisioner

func NewFakeProvisioner() *FakeProvisioner

func (*FakeProvisioner) AddUnit

func (p *FakeProvisioner) AddUnit(app provision.App, unit provision.Unit)

func (*FakeProvisioner) AddUnits

func (p *FakeProvisioner) AddUnits(app provision.App, n uint, process string, w io.Writer) ([]provision.Unit, error)

func (*FakeProvisioner) Addr

func (p *FakeProvisioner) Addr(app provision.App) (string, error)

func (*FakeProvisioner) ArchiveDeploy

func (p *FakeProvisioner) ArchiveDeploy(app provision.App, archiveURL string, w io.Writer) (string, error)

func (*FakeProvisioner) CustomData

func (p *FakeProvisioner) CustomData(app provision.App) map[string]interface{}

func (*FakeProvisioner) Destroy

func (p *FakeProvisioner) Destroy(app provision.App) error

func (*FakeProvisioner) ExecuteCommand

func (p *FakeProvisioner) ExecuteCommand(stdout, stderr io.Writer, app provision.App, cmd string, args ...string) error

ExecuteCommand will pretend to execute the given command, recording data about it.

The output of the command must be prepared with PrepareOutput, and failures must be prepared with PrepareFailure. In case of failure, the prepared output will be sent to the standard error stream, otherwise, it will be sent to the standard error stream.

When there is no output nor failure prepared, ExecuteCommand will return a timeout error.

func (*FakeProvisioner) ExecuteCommandOnce

func (p *FakeProvisioner) ExecuteCommandOnce(stdout, stderr io.Writer, app provision.App, cmd string, args ...string) error

func (*FakeProvisioner) GetCmds

func (p *FakeProvisioner) GetCmds(cmd string, app provision.App) []Cmd

Returns the number of calls to restart. GetCmds returns a list of commands executed in an app. If you don't specify the command (an empty string), it will return all commands executed in the given app.

func (*FakeProvisioner) GetUnits

func (p *FakeProvisioner) GetUnits(app provision.App) []provision.Unit

func (*FakeProvisioner) GitDeploy

func (p *FakeProvisioner) GitDeploy(app provision.App, version string, w io.Writer) (string, error)

func (*FakeProvisioner) HasCName

func (p *FakeProvisioner) HasCName(app provision.App, cname string) bool

func (*FakeProvisioner) ImageDeploy

func (p *FakeProvisioner) ImageDeploy(app provision.App, img string, w io.Writer) (string, error)

func (*FakeProvisioner) MetricEnvs

func (p *FakeProvisioner) MetricEnvs(app provision.App) map[string]string

MetricEnvs returns the metric envs for the app

func (*FakeProvisioner) PrepareFailure

func (p *FakeProvisioner) PrepareFailure(method string, err error)

PrepareFailure prepares a failure for the given method name.

For instance, PrepareFailure("GitDeploy", errors.New("GitDeploy failed")) will cause next Deploy call to return the given error. Multiple calls to this method will enqueue failures, i.e. three calls to PrepareFailure("GitDeploy"...) means that the three next GitDeploy call will fail.

func (*FakeProvisioner) PrepareOutput

func (p *FakeProvisioner) PrepareOutput(b []byte)

PrepareOutput sends the given slice of bytes to a queue of outputs.

Each prepared output will be used in the ExecuteCommand. It might be sent to the standard output or standard error. See ExecuteCommand docs for more details.

func (*FakeProvisioner) Provision

func (p *FakeProvisioner) Provision(app provision.App) error

func (*FakeProvisioner) Provisioned

func (p *FakeProvisioner) Provisioned(app provision.App) bool

Provisioned checks whether the given app has been provisioned.

func (*FakeProvisioner) RegisterUnit

func (p *FakeProvisioner) RegisterUnit(unit provision.Unit, customData map[string]interface{}) error

func (*FakeProvisioner) RemoveUnits

func (p *FakeProvisioner) RemoveUnits(app provision.App, n uint, process string, w io.Writer) error

func (*FakeProvisioner) Reset

func (p *FakeProvisioner) Reset()

Reset cleans up the FakeProvisioner, deleting all apps and their data. It also deletes prepared failures and output. It's like calling NewFakeProvisioner again, without all the allocations.

func (*FakeProvisioner) Restart

func (p *FakeProvisioner) Restart(app provision.App, process string, w io.Writer) error

func (*FakeProvisioner) Restarts

func (p *FakeProvisioner) Restarts(app provision.App, process string) int

Restarts returns the number of restarts for a given app.

func (*FakeProvisioner) RoutableUnits

func (p *FakeProvisioner) RoutableUnits(app provision.App) ([]provision.Unit, error)

func (*FakeProvisioner) SetCName

func (p *FakeProvisioner) SetCName(app provision.App, cname string) error

func (*FakeProvisioner) SetUnitStatus

func (p *FakeProvisioner) SetUnitStatus(unit provision.Unit, status provision.Status) error

func (*FakeProvisioner) Shell

func (*FakeProvisioner) Shells

func (p *FakeProvisioner) Shells(unit string) []provision.ShellOptions

Shells return all shell calls to the given unit.

func (*FakeProvisioner) Start

func (p *FakeProvisioner) Start(app provision.App, process string) error

func (*FakeProvisioner) Starts

func (p *FakeProvisioner) Starts(app provision.App, process string) int

Starts returns the number of starts for a given app.

func (*FakeProvisioner) Stop

func (p *FakeProvisioner) Stop(app provision.App, process string) error

func (*FakeProvisioner) Stops

func (p *FakeProvisioner) Stops(app provision.App, process string) int

Stops returns the number of stops for a given app.

func (*FakeProvisioner) Swap

func (p *FakeProvisioner) Swap(app1, app2 provision.App) error

func (*FakeProvisioner) Units

func (p *FakeProvisioner) Units(app provision.App) ([]provision.Unit, error)

func (*FakeProvisioner) UnsetCName

func (p *FakeProvisioner) UnsetCName(app provision.App, cname string) error

func (*FakeProvisioner) UploadDeploy

func (p *FakeProvisioner) UploadDeploy(app provision.App, file io.ReadCloser, w io.Writer) (string, error)

func (*FakeProvisioner) ValidAppImages

func (p *FakeProvisioner) ValidAppImages(appName string) ([]string, error)

func (*FakeProvisioner) Version

func (p *FakeProvisioner) Version(app provision.App) string

Version returns the last deployed for a given app.

type Hijacker

type Hijacker struct {
	http.ResponseWriter
	Conn net.Conn
	Err  error
}

func (*Hijacker) Hijack

func (h *Hijacker) Hijack() (net.Conn, *bufio.ReadWriter, error)

type PipelineErrorFakeProvisioner

type PipelineErrorFakeProvisioner struct {
	*FakeProvisioner
}

func (*PipelineErrorFakeProvisioner) DeployPipeline

func (p *PipelineErrorFakeProvisioner) DeployPipeline() *action.Pipeline

type PipelineFakeProvisioner

type PipelineFakeProvisioner struct {
	*FakeProvisioner
	// contains filtered or unexported fields
}

func (*PipelineFakeProvisioner) DeployPipeline

func (p *PipelineFakeProvisioner) DeployPipeline() *action.Pipeline

func (*PipelineFakeProvisioner) ExecutedPipeline

func (p *PipelineFakeProvisioner) ExecutedPipeline() bool

Jump to

Keyboard shortcuts

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