dummy

package
v0.0.0-...-4bd6544 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2016 License: AGPL-3.0 Imports: 43 Imported by: 0

Documentation

Overview

The dummy provider implements an environment provider for testing purposes, registered with environs under the name "dummy".

The configuration YAML for the testing environment must specify a "controller" property with a boolean value. If this is true, a controller will be started when the environment is bootstrapped.

The configuration data also accepts a "broken" property of type boolean. If this is non-empty, any operation after the environment has been opened will return the error "broken environment", and will also log that.

The DNS name of instances is the same as the Id, with ".dns" appended.

Index

Constants

View Source
const BootstrapInstanceId = "localhost"

Variables

View Source
var DataDir = ""

Override for testing - the data directory with which the state api server is initialised.

View Source
var LogDir = ""

Functions

func APIPort

func APIPort(p environs.EnvironProvider) int

APIPort returns the randon api port used by the given provider instance.

func Listen

func Listen(c chan<- Operation)

Listen directs subsequent operations on any dummy environment to channel c (if not nil).

func PatchTransientErrorInjectionChannel

func PatchTransientErrorInjectionChannel(c chan error) func()

PatchTransientErrorInjectionChannel sets the transientInjectionError channel which can be used to inject errors into StartInstance for testing purposes The injected errors will use the string received on the channel and the instance's state will eventually go to error, while the received string will appear in the info field of the machine's status

func Reset

func Reset(c *gc.C)

Reset resets the entire dummy environment and forgets any registered operation listener. All opened environments after Reset will share the same underlying state.

func SampleCloudSpec

func SampleCloudSpec() environs.CloudSpec

SampleCloudSpec returns an environs.CloudSpec that can be used to open a dummy Environ.

func SampleConfig

func SampleConfig() testing.Attrs

SampleConfig() returns an environment configuration with all required attributes set.

func SetInstanceAddresses

func SetInstanceAddresses(inst instance.Instance, addrs []network.Address)

SetInstanceAddresses sets the addresses associated with the given dummy instance.

func SetInstanceBroken

func SetInstanceBroken(inst instance.Instance, methods ...string)

SetInstanceBroken marks the named methods of the instance as broken. Any previously broken methods not in the set will no longer be broken.

func SetInstanceStatus

func SetInstanceStatus(inst instance.Instance, status string)

SetInstanceStatus sets the status associated with the given dummy instance.

func SetSupportsSpaceDiscovery

func SetSupportsSpaceDiscovery(supports bool) bool

SetSupportsSpaceDiscovery allows to enable and disable SupportsSpaceDiscovery for tests.

func SetSupportsSpaces

func SetSupportsSpaces(supports bool) bool

SetSupportsSpaces allows to enable and disable SupportsSpaces for tests.

func StorageProviders

func StorageProviders() storage.ProviderRegistry

Types

type OpBootstrap

type OpBootstrap struct {
	Context environs.BootstrapContext
	Env     string
	Args    environs.BootstrapParams
}

type OpClosePorts

type OpClosePorts struct {
	Env        string
	MachineId  string
	InstanceId instance.Id
	Ports      []network.PortRange
}

type OpDestroy

type OpDestroy struct {
	Env         string
	Cloud       string
	CloudRegion string
	Error       error
}

type OpFinalizeBootstrap

type OpFinalizeBootstrap struct {
	Context        environs.BootstrapContext
	Env            string
	InstanceConfig *instancecfg.InstanceConfig
}

type OpNetworkInterfaces

type OpNetworkInterfaces struct {
	Env        string
	InstanceId instance.Id
	Info       []network.InterfaceInfo
}

type OpOpenPorts

type OpOpenPorts struct {
	Env        string
	MachineId  string
	InstanceId instance.Id
	Ports      []network.PortRange
}

type OpPutFile

type OpPutFile struct {
	Env      string
	FileName string
}

type OpStartInstance

type OpStartInstance struct {
	Env              string
	MachineId        string
	MachineNonce     string
	PossibleTools    coretools.List
	Instance         instance.Instance
	Constraints      constraints.Value
	SubnetsToZones   map[network.Id][]string
	NetworkInfo      []network.InterfaceInfo
	Volumes          []storage.Volume
	Info             *mongo.MongoInfo
	Jobs             []multiwatcher.MachineJob
	APIInfo          *api.Info
	Secret           string
	AgentEnvironment map[string]string
}

type OpStopInstances

type OpStopInstances struct {
	Env string
	Ids []instance.Id
}

type OpSubnets

type OpSubnets struct {
	Env        string
	InstanceId instance.Id
	SubnetIds  []network.Id
	Info       []network.SubnetInfo
}

type Operation

type Operation interface{}

Operation represents an action on the dummy provider.

Jump to

Keyboard shortcuts

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