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.
To avoid enumerating all possible series and architectures, any series or architecture with the prefix "unknown" is treated as bad when starting a new instance.
Index ¶
- Constants
- Variables
- func Listen(c chan<- Operation)
- func PatchTransientErrorInjectionChannel(c chan error) func()
- func Reset(c *gc.C)
- func SampleConfig() testing.Attrs
- func SetInstanceAddresses(inst instance.Instance, addrs []network.Address)
- func SetInstanceBroken(inst instance.Instance, methods ...string)
- func SetInstanceStatus(inst instance.Instance, status string)
- func SetStatePolicy(policy state.Policy)
- func SetSupportsSpaceDiscovery(supports bool) bool
- func SetSupportsSpaces(supports bool) bool
- type OpAllocateAddress
- type OpBootstrap
- type OpClosePorts
- type OpDestroy
- type OpFinalizeBootstrap
- type OpNetworkInterfaces
- type OpOpenPorts
- type OpPutFile
- type OpReleaseAddress
- type OpStartInstance
- type OpStopInstances
- type OpSubnets
- type Operation
Constants ¶
const BootstrapInstanceId = "localhost"
Variables ¶
var DataDir = ""
Override for testing - the data directory with which the state api server is initialised.
var LogDir = ""
Functions ¶
func Listen ¶
func Listen(c chan<- Operation)
Listen closes the previously registered listener (if any). Subsequent operations on any dummy environment can be received on 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 ¶
Reset resets the entire dummy environment and forgets any registered operation listener. All opened environments after Reset will share the same underlying state.
func SampleConfig ¶
SampleConfig() returns an environment configuration with all required attributes set.
func SetInstanceAddresses ¶
SetInstanceAddresses sets the addresses associated with the given dummy instance.
func SetInstanceBroken ¶
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 ¶
SetInstanceStatus sets the status associated with the given dummy instance.
func SetStatePolicy ¶
SetStatePolicy sets the state.Policy to use when a controller is initialised by dummy.
func SetSupportsSpaceDiscovery ¶
SetSupportsSpaceDiscovery allows to enable and disable SupportsSpaceDiscovery for tests.
func SetSupportsSpaces ¶
SetSupportsSpaces allows to enable and disable SupportsSpaces for tests.
Types ¶
type OpAllocateAddress ¶
type OpBootstrap ¶
type OpBootstrap struct { Context environs.BootstrapContext Env string Args environs.BootstrapParams }
type OpClosePorts ¶
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 OpReleaseAddress ¶
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 }