provisiontest

package
v0.0.0-...-9451de5 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2019 License: BSD-3-Clause Imports: 25 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 FakeApp

type FakeApp struct {
	IP string

	Commands []string
	Memory   int64
	Swap     int64
	CpuShare int

	Deploys uint

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

Fake implementation for provision.App.

func NewFakeApp

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

func NewFakeAppWithPool

func NewFakeAppWithPool(name, platform, pool string, units int) *FakeApp

func (*FakeApp) AddInstance

func (a *FakeApp) AddInstance(instanceArgs bind.AddInstanceArgs) 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

func (*FakeApp) GetAddresses

func (app *FakeApp) GetAddresses() ([]string, error)

func (*FakeApp) GetCname

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

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) GetLock

func (a *FakeApp) GetLock() provision.AppLock

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) GetPlatformVersion

func (a *FakeApp) GetPlatformVersion() string

func (*FakeApp) GetPool

func (a *FakeApp) GetPool() string

func (*FakeApp) GetQuota

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

func (*FakeApp) GetRouters

func (app *FakeApp) GetRouters() []appTypes.AppRouter

func (*FakeApp) GetServiceEnvs

func (a *FakeApp) GetServiceEnvs() []bind.ServiceEnvVar

func (*FakeApp) GetSwap

func (a *FakeApp) GetSwap() int64

func (*FakeApp) GetTeamOwner

func (a *FakeApp) GetTeamOwner() string

func (*FakeApp) GetTeamsName

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

func (*FakeApp) GetUUID

func (a *FakeApp) GetUUID() (string, error)

func (*FakeApp) GetUnits

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

func (*FakeApp) GetUpdatePlatform

func (a *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) 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(instanceArgs bind.RemoveInstanceArgs) error

func (*FakeApp) Run

func (a *FakeApp) Run(cmd string, w io.Writer, args provision.RunArgs) error

func (*FakeApp) SetEnv

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

func (*FakeApp) SetEnvs

func (a *FakeApp) SetEnvs(setEnvs bind.SetEnvArgs) 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.UnsetEnvArgs) 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 FakeNode

type FakeNode struct {
	ID       string
	Addr     string
	PoolName string
	Meta     map[string]string
	// contains filtered or unexported fields
}

func (*FakeNode) Address

func (n *FakeNode) Address() string

func (*FakeNode) FailureCount

func (n *FakeNode) FailureCount() int

func (*FakeNode) HasSuccess

func (n *FakeNode) HasSuccess() bool

func (*FakeNode) IaaSID

func (n *FakeNode) IaaSID() string

func (*FakeNode) Metadata

func (n *FakeNode) Metadata() map[string]string

func (*FakeNode) MetadataNoPrefix

func (n *FakeNode) MetadataNoPrefix() map[string]string

func (*FakeNode) Pool

func (n *FakeNode) Pool() string

func (*FakeNode) Provisioner

func (n *FakeNode) Provisioner() provision.NodeProvisioner

func (*FakeNode) ResetFailures

func (n *FakeNode) ResetFailures()

func (*FakeNode) SetHealth

func (n *FakeNode) SetHealth(failures int, hasSuccess bool)

func (*FakeNode) Status

func (n *FakeNode) Status() string

func (*FakeNode) Units

func (n *FakeNode) Units() ([]provision.Unit, error)

type FakeProvisioner

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

Fake implementation for provision.Provisioner.

var (
	ProvisionerInstance *FakeProvisioner
)

func NewFakeProvisioner

func NewFakeProvisioner() *FakeProvisioner

func (*FakeProvisioner) AddNode

func (p *FakeProvisioner) AddNode(opts provision.AddNodeOptions) error

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) error

func (*FakeProvisioner) AddUnitsToNode

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

func (*FakeProvisioner) Addr

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

func (*FakeProvisioner) AllExecs

func (p *FakeProvisioner) AllExecs() map[string][]provision.ExecOptions

AllExecs return all exec calls to all units.

func (*FakeProvisioner) ArchiveDeploy

func (p *FakeProvisioner) ArchiveDeploy(app provision.App, archiveURL string, evt *event.Event) (string, error)

func (*FakeProvisioner) CleanImage

func (p *FakeProvisioner) CleanImage(appName, imgName string) error

func (*FakeProvisioner) CustomData

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

func (*FakeProvisioner) DeleteVolume

func (p *FakeProvisioner) DeleteVolume(volName, pool string) error

func (*FakeProvisioner) Deploy

func (p *FakeProvisioner) Deploy(app provision.App, img string, evt *event.Event) (string, error)

func (*FakeProvisioner) Destroy

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

func (*FakeProvisioner) Execs

func (p *FakeProvisioner) Execs(unit string) []provision.ExecOptions

Execs return all exec calls to the given unit.

func (*FakeProvisioner) ExecuteCommand

func (p *FakeProvisioner) ExecuteCommand(opts provision.ExecOptions) error

func (*FakeProvisioner) FilterAppsByUnitStatus

func (p *FakeProvisioner) FilterAppsByUnitStatus(apps []provision.App, status []string) ([]provision.App, error)

func (*FakeProvisioner) GetAppFromUnitID

func (p *FakeProvisioner) GetAppFromUnitID(unitID string) (provision.App, error)

GetAppFromUnitID returns an app from unitID

func (*FakeProvisioner) GetClient

func (*FakeProvisioner) GetName

func (p *FakeProvisioner) GetName() string

func (*FakeProvisioner) GetNode

func (p *FakeProvisioner) GetNode(address string) (provision.Node, error)

func (*FakeProvisioner) GetUnits

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

func (*FakeProvisioner) HasCName

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

func (*FakeProvisioner) HasNodeContainer

func (p *FakeProvisioner) HasNodeContainer(name string, pool string) bool

func (*FakeProvisioner) ImageDeploy

func (p *FakeProvisioner) ImageDeploy(app provision.App, img string, evt *event.Event) (string, error)

func (*FakeProvisioner) IsVolumeProvisioned

func (p *FakeProvisioner) IsVolumeProvisioned(name, pool string) (bool, error)

func (*FakeProvisioner) ListNodes

func (p *FakeProvisioner) ListNodes(addressFilter []string) ([]provision.Node, error)

func (*FakeProvisioner) NodeForNodeData

func (p *FakeProvisioner) NodeForNodeData(nodeData provision.NodeStatusData) (provision.Node, error)

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) RebalanceNodes

func (p *FakeProvisioner) RebalanceNodes(opts provision.RebalanceNodesOptions) (bool, error)

func (*FakeProvisioner) Rebuild

func (p *FakeProvisioner) Rebuild(app provision.App, evt *event.Event) (string, error)

func (*FakeProvisioner) RegisterUnit

func (p *FakeProvisioner) RegisterUnit(a provision.App, unitId string, customData map[string]interface{}) error

func (*FakeProvisioner) RemoveNode

func (p *FakeProvisioner) RemoveNode(opts provision.RemoveNodeOptions) error

func (*FakeProvisioner) RemoveNodeContainer

func (p *FakeProvisioner) RemoveNodeContainer(name string, pool string, writer io.Writer) 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(a provision.App, process string) int

Restarts returns the number of restarts for a given app.

func (*FakeProvisioner) Rollback

func (p *FakeProvisioner) Rollback(app provision.App, img string, evt *event.Event) (string, error)

func (*FakeProvisioner) RoutableAddresses

func (p *FakeProvisioner) RoutableAddresses(app provision.App) ([]url.URL, 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) Sleep

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

func (*FakeProvisioner) Sleeps

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

Sleeps returns the number of sleeps for a given app.

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, cnameOnly bool) error

func (*FakeProvisioner) Units

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

func (*FakeProvisioner) UnsetCName

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

func (*FakeProvisioner) UpdateApp

func (p *FakeProvisioner) UpdateApp(old, new provision.App, w io.Writer) error

func (*FakeProvisioner) UpdateNode

func (p *FakeProvisioner) UpdateNode(opts provision.UpdateNodeOptions) error

func (*FakeProvisioner) UpgradeNodeContainer

func (p *FakeProvisioner) UpgradeNodeContainer(name string, pool string, writer io.Writer) error

func (*FakeProvisioner) UploadDeploy

func (p *FakeProvisioner) UploadDeploy(app provision.App, file io.ReadCloser, fileSize int64, build bool, evt *event.Event) (string, error)

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