juju: github.com/wallyworld/juju/provider/dummy Index | Files

package dummy

import "github.com/wallyworld/juju/provider/dummy"

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.


Package Files

environs.go instance_information.go leasestore.go storage.go


const BootstrapInstanceId = "localhost"


var DataDir = ""

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

var LogDir = ""

func APIPort Uses

func APIPort(p environs.EnvironProvider) int

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

func Listen Uses

func Listen(c chan<- Operation)

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

func PatchTransientErrorInjectionChannel Uses

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 Uses

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 Uses

func SampleCloudSpec() environscloudspec.CloudSpec

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

func SampleConfig Uses

func SampleConfig() testing.Attrs

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

func SetInstanceAddresses Uses

func SetInstanceAddresses(inst instances.Instance, addrs []corenetwork.ProviderAddress)

SetInstanceAddresses sets the addresses associated with the given dummy instance.

func SetInstanceBroken Uses

func SetInstanceBroken(inst instances.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 Uses

func SetInstanceStatus(inst instances.Instance, status string)

SetInstanceStatus sets the status associated with the given dummy instance.

func SetSupportsSpaceDiscovery Uses

func SetSupportsSpaceDiscovery(supports bool) bool

SetSupportsSpaceDiscovery allows to enable and disable SupportsSpaceDiscovery for tests.

func SetSupportsSpaces Uses

func SetSupportsSpaces(supports bool) bool

SetSupportsSpaces allows to enable and disable SupportsSpaces for tests.

func StorageProviders Uses

func StorageProviders() storage.ProviderRegistry

type OpBootstrap Uses

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

type OpClosePorts Uses

type OpClosePorts struct {
    Env        string
    MachineId  string
    InstanceId instance.Id
    Rules      []network.IngressRule

type OpDestroy Uses

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

type OpFinalizeBootstrap Uses

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

type OpNetworkInterfaces Uses

type OpNetworkInterfaces struct {
    Env        string
    InstanceId instance.Id
    Info       corenetwork.InterfaceInfos

type OpOpenPorts Uses

type OpOpenPorts struct {
    Env        string
    MachineId  string
    InstanceId instance.Id
    Rules      []network.IngressRule

type OpPutFile Uses

type OpPutFile struct {
    Env      string
    FileName string

type OpStartInstance Uses

type OpStartInstance struct {
    Env               string
    MachineId         string
    MachineNonce      string
    PossibleTools     coretools.List
    Instance          instances.Instance
    Constraints       constraints.Value
    SubnetsToZones    map[corenetwork.Id][]string
    NetworkInfo       corenetwork.InterfaceInfos
    Volumes           []storage.Volume
    VolumeAttachments []storage.VolumeAttachment
    Info              *mongo.MongoInfo
    Jobs              []model.MachineJob
    APIInfo           *api.Info
    Secret            string
    AgentEnvironment  map[string]string

type OpStopInstances Uses

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

type OpSubnets Uses

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

type Operation Uses

type Operation interface{}

Operation represents an action on the dummy provider.

Package dummy imports 67 packages (graph). Updated 2020-08-06. Refresh now. Tools for package owners.