juju: github.com/kat-co/juju/testing/factory Index | Files

package factory

import "github.com/kat-co/juju/testing/factory"

Index

Package Files

factory.go

type ApplicationParams Uses

type ApplicationParams struct {
    Name        string
    Charm       *state.Charm
    Status      *status.StatusInfo
    Settings    map[string]interface{}
    Storage     map[string]state.StorageConstraints
    Constraints constraints.Value
}

ApplicationParams is used when specifying parameters for a new application.

type CharmParams Uses

type CharmParams struct {
    Name     string
    Series   string
    Revision string
    URL      string
}

CharmParams defines the parameters for creating a charm.

type Factory Uses

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

func NewFactory Uses

func NewFactory(st *state.State) *Factory

func (*Factory) MakeApplication Uses

func (factory *Factory) MakeApplication(c *gc.C, params *ApplicationParams) *state.Application

MakeApplication creates an application with the specified parameters, substituting sane defaults for missing values. If params is not specified, defaults are used.

func (*Factory) MakeCharm Uses

func (factory *Factory) MakeCharm(c *gc.C, params *CharmParams) *state.Charm

MakeCharm creates a charm with the values specified in params. Sensible default values are substituted for missing ones. Supported charms depend on the charm/testing package. Currently supported charms:

all-hooks, category, dummy, format2, logging, monitoring, mysql,
mysql-alternative, riak, terracotta, upgrade1, upgrade2, varnish,
varnish-alternative, wordpress.

If params is not specified, defaults are used.

func (*Factory) MakeMachine Uses

func (factory *Factory) MakeMachine(c *gc.C, params *MachineParams) *state.Machine

MakeMachine will add a machine with values defined in params. For some values in params, if they are missing, some meaningful empty values will be set. If params is not specified, defaults are used.

func (*Factory) MakeMachineNested Uses

func (factory *Factory) MakeMachineNested(c *gc.C, parentId string, params *MachineParams) *state.Machine

MakeMachineNested will make a machine nested in the machine with ID given.

func (*Factory) MakeMachineReturningPassword Uses

func (factory *Factory) MakeMachineReturningPassword(c *gc.C, params *MachineParams) (*state.Machine, string)

MakeMachineReturningPassword will add a machine with values defined in params. For some values in params, if they are missing, some meaningful empty values will be set. If params is not specified, defaults are used. The machine and its password are returned.

func (*Factory) MakeMetric Uses

func (factory *Factory) MakeMetric(c *gc.C, params *MetricParams) *state.MetricBatch

MakeMetric makes a metric with specified params, filling in sane defaults for missing values. If params is not specified, defaults are used.

func (*Factory) MakeModel Uses

func (factory *Factory) MakeModel(c *gc.C, params *ModelParams) *state.State

MakeModel creates an model with specified params, filling in sane defaults for missing values. If params is nil, defaults are used for all values.

By default the new model shares the same owner as the calling Factory's model.

func (*Factory) MakeModelUser Uses

func (factory *Factory) MakeModelUser(c *gc.C, params *ModelUserParams) permission.UserAccess

MakeModelUser will create a modelUser with values defined by the params. For attributes of ModelUserParams that are the default empty values, some meaningful valid values are used instead. If params is not specified, defaults are used.

func (*Factory) MakeRelation Uses

func (factory *Factory) MakeRelation(c *gc.C, params *RelationParams) *state.Relation

MakeRelation create a relation with specified params, filling in sane defaults for missing values. If params is not specified, defaults are used.

func (*Factory) MakeSpace Uses

func (factory *Factory) MakeSpace(c *gc.C, params *SpaceParams) *state.Space

MakeSpace will create a new space with the specified params. If the space name is not set, a unique space name is created.

func (*Factory) MakeUnit Uses

func (factory *Factory) MakeUnit(c *gc.C, params *UnitParams) *state.Unit

MakeUnit creates an application unit with specified params, filling in sane defaults for missing values. If params is not specified, defaults are used.

func (*Factory) MakeUnitReturningPassword Uses

func (factory *Factory) MakeUnitReturningPassword(c *gc.C, params *UnitParams) (*state.Unit, string)

MakeUnit creates an application unit with specified params, filling in sane defaults for missing values. If params is not specified, defaults are used. The unit and its password are returned.

func (*Factory) MakeUnprovisionedMachineReturningPassword Uses

func (factory *Factory) MakeUnprovisionedMachineReturningPassword(c *gc.C, params *MachineParams) (*state.Machine, string)

MakeUnprovisionedMachineReturningPassword will add a machine with values defined in params. For some values in params, if they are missing, some meaningful empty values will be set. If params is not specified, defaults are used. The machine and its password are returned; the machine will not be provisioned.

func (*Factory) MakeUser Uses

func (factory *Factory) MakeUser(c *gc.C, params *UserParams) *state.User

MakeUser will create a user with values defined by the params. For attributes of UserParams that are the default empty values, some meaningful valid values are used instead. If params is not specified, defaults are used. If params.NoModelUser is false, the user will also be created in the current model.

func (*Factory) RandomSuffix Uses

func (*Factory) RandomSuffix(prefix string) string

RandomSuffix adds a random 5 character suffix to the presented string.

type MachineParams Uses

type MachineParams struct {
    Series          string
    Jobs            []state.MachineJob
    Password        string
    Nonce           string
    Constraints     constraints.Value
    InstanceId      instance.Id
    Characteristics *instance.HardwareCharacteristics
    Addresses       []network.Address
    Volumes         []state.MachineVolumeParams
    Filesystems     []state.MachineFilesystemParams
}

Params for creating a machine.

type MetricParams Uses

type MetricParams struct {
    Unit       *state.Unit
    Time       *time.Time
    Metrics    []state.Metric
    Sent       bool
    DeleteTime *time.Time
}

type ModelParams Uses

type ModelParams struct {
    Name                    string
    Owner                   names.Tag
    ConfigAttrs             testing.Attrs
    CloudName               string
    CloudRegion             string
    CloudCredential         names.CloudCredentialTag
    StorageProviderRegistry storage.ProviderRegistry
}

type ModelUserParams Uses

type ModelUserParams struct {
    User        string
    DisplayName string
    CreatedBy   names.Tag
    Access      permission.Access
}

ModelUserParams defines the parameters for creating an environment user.

type RelationParams Uses

type RelationParams struct {
    Endpoints []state.Endpoint
}

RelationParams are used to create relations.

type SpaceParams Uses

type SpaceParams struct {
    Name       string
    ProviderID network.Id
    Subnets    []string
    IsPublic   bool
}

type UnitParams Uses

type UnitParams struct {
    Application *state.Application
    Machine     *state.Machine
    Password    string
    SetCharmURL bool
    Status      *status.StatusInfo
    Constraints constraints.Value
}

UnitParams are used to create units.

type UserParams Uses

type UserParams struct {
    Name        string
    DisplayName string
    Password    string
    Creator     names.Tag
    NoModelUser bool
    Disabled    bool
    Access      permission.Access
}

UserParams defines the parameters for creating a user with MakeUser.

Package factory imports 24 packages (graph). Updated 2016-10-04. Refresh now. Tools for package owners.