Documentation ¶
Index ¶
- Constants
- func AddStateServerMachine(c *gc.C, st *state.State) *state.Machine
- func AssertStartInstance(c *gc.C, env environs.Environ, machineId string) (instance.Instance, *instance.HardwareCharacteristics)
- func AssertStartInstanceWithConstraints(c *gc.C, env environs.Environ, machineId string, cons constraints.Value) (instance.Instance, *instance.HardwareCharacteristics)
- func AssertStartInstanceWithNetworks(c *gc.C, env environs.Environ, machineId string, cons constraints.Value, ...) (instance.Instance, *instance.HardwareCharacteristics)
- func FakeAPIInfo(machineId string) *api.Info
- func FakeStateInfo(machineId string) *mongo.MongoInfo
- func PreferredDefaultVersions(conf *config.Config, template version.Binary) []version.Binary
- func PutCharm(st *state.State, curl *charm.URL, repo charm.Repository, bumpRevision bool) (*state.Charm, error)
- func StartInstance(env environs.Environ, machineId string) (instance.Instance, *instance.HardwareCharacteristics, []network.InterfaceInfo, ...)
- func StartInstanceWithConstraints(env environs.Environ, machineId string, cons constraints.Value) (instance.Instance, *instance.HardwareCharacteristics, []network.InterfaceInfo, ...)
- func StartInstanceWithConstraintsAndNetworks(env environs.Environ, machineId string, cons constraints.Value, ...) (instance.Instance, *instance.HardwareCharacteristics, []network.InterfaceInfo, ...)
- func StartInstanceWithParams(env environs.Environ, machineId string, params environs.StartInstanceParams, ...) (*environs.StartInstanceResult, error)
- func WaitInstanceAddresses(env environs.Environ, instId instance.Id) ([]network.Address, error)
- type GetStater
- type JujuConnSuite
- func (s *JujuConnSuite) APIInfo(c *gc.C) *api.Info
- func (s *JujuConnSuite) AddDefaultToolsToState(c *gc.C)
- func (s *JujuConnSuite) AddTestingCharm(c *gc.C, name string) *state.Charm
- func (s *JujuConnSuite) AddTestingService(c *gc.C, name string, ch *state.Charm) *state.Service
- func (s *JujuConnSuite) AddTestingServiceWithNetworks(c *gc.C, name string, ch *state.Charm, networks []string) *state.Service
- func (s *JujuConnSuite) AddTestingServiceWithStorage(c *gc.C, name string, ch *state.Charm, ...) *state.Service
- func (s *JujuConnSuite) AddToolsToState(c *gc.C, versions ...version.Binary)
- func (s *JujuConnSuite) AdminUserTag(c *gc.C) names.UserTag
- func (s *JujuConnSuite) AgentConfigForTag(c *gc.C, tag names.Tag) agent.ConfigSetter
- func (s *JujuConnSuite) AssertConfigParameterUpdated(c *gc.C, key string, value interface{})
- func (s *JujuConnSuite) DataDir() string
- func (s *JujuConnSuite) MongoInfo(c *gc.C) *mongo.MongoInfo
- func (s *JujuConnSuite) OpenAPIAs(c *gc.C, tag names.Tag, password string) *api.State
- func (s *JujuConnSuite) OpenAPIAsMachine(c *gc.C, tag names.Tag, password, nonce string) *api.State
- func (s *JujuConnSuite) OpenAPIAsNewMachine(c *gc.C, jobs ...state.MachineJob) (*api.State, *state.Machine)
- func (s *JujuConnSuite) Reset(c *gc.C)
- func (s *JujuConnSuite) SetUpSuite(c *gc.C)
- func (s *JujuConnSuite) SetUpTest(c *gc.C)
- func (s *JujuConnSuite) TearDownSuite(c *gc.C)
- func (s *JujuConnSuite) TearDownTest(c *gc.C)
- func (s *JujuConnSuite) WriteConfig(configData string)
- type RepoSuite
- func (s *RepoSuite) AssertCharmUploaded(c *gc.C, curl *charm.URL)
- func (s *RepoSuite) AssertService(c *gc.C, name string, expectCurl *charm.URL, unitCount, relCount int) (*state.Service, []*state.Relation)
- func (s *RepoSuite) AssertUnitMachines(c *gc.C, units []*state.Unit)
- func (s *RepoSuite) SetUpTest(c *gc.C)
- func (s *RepoSuite) TearDownTest(c *gc.C)
Constants ¶
const AdminSecret = "dummy-secret"
Variables ¶
This section is empty.
Functions ¶
func AddStateServerMachine ¶
AddStateServerMachine adds a "state server" machine to the state so that State.Addresses and State.APIAddresses will work. It returns the added machine. The addresses that those methods will return bear no relation to the addresses actually used by the state and API servers. It returns the addresses that will be returned by the State.Addresses and State.APIAddresses methods, which will not bear any relation to the be the addresses used by the state servers.
func AssertStartInstance ¶
func AssertStartInstance( c *gc.C, env environs.Environ, machineId string, ) ( instance.Instance, *instance.HardwareCharacteristics, )
AssertStartInstance is a test helper function that starts an instance with a plausible but invalid configuration, and checks that it succeeds.
func AssertStartInstanceWithConstraints ¶
func AssertStartInstanceWithConstraints( c *gc.C, env environs.Environ, machineId string, cons constraints.Value, ) ( instance.Instance, *instance.HardwareCharacteristics, )
AssertStartInstanceWithConstraints is a test helper function that starts an instance with the given constraints, and a plausible but invalid configuration, and returns the result of Environ.StartInstance.
func AssertStartInstanceWithNetworks ¶
func AssertStartInstanceWithNetworks( c *gc.C, env environs.Environ, machineId string, cons constraints.Value, networks []string, ) ( instance.Instance, *instance.HardwareCharacteristics, )
AssertStartInstanceWithNetworks is a test helper function that starts an instance with the given networks, and a plausible but invalid configuration, and returns the result of Environ.StartInstance.
func FakeAPIInfo ¶
FakeAPIInfo holds information about no state - it will always give an error when connected to. The machine id gives the machine id of the machine to be started.
func FakeStateInfo ¶
FakeStateInfo holds information about no state - it will always give an error when connected to. The machine id gives the machine id of the machine to be started.
func PutCharm ¶
func PutCharm(st *state.State, curl *charm.URL, repo charm.Repository, bumpRevision bool) (*state.Charm, error)
PutCharm uploads the given charm to provider storage, and adds a state.Charm to the state. The charm is not uploaded if a charm with the same URL already exists in the state. If bumpRevision is true, the charm must be a local directory, and the revision number will be incremented before pushing.
func StartInstance ¶
func StartInstance( env environs.Environ, machineId string, ) ( instance.Instance, *instance.HardwareCharacteristics, []network.InterfaceInfo, error, )
StartInstance is a test helper function that starts an instance with a plausible but invalid configuration, and returns the result of Environ.StartInstance.
func StartInstanceWithConstraints ¶
func StartInstanceWithConstraints( env environs.Environ, machineId string, cons constraints.Value, ) ( instance.Instance, *instance.HardwareCharacteristics, []network.InterfaceInfo, error, )
StartInstanceWithConstraints is a test helper function that starts an instance with the given constraints, and a plausible but invalid configuration, and returns the result of Environ.StartInstance.
func StartInstanceWithConstraintsAndNetworks ¶
func StartInstanceWithConstraintsAndNetworks( env environs.Environ, machineId string, cons constraints.Value, networks []string, ) ( instance.Instance, *instance.HardwareCharacteristics, []network.InterfaceInfo, error, )
StartInstanceWithConstraintsAndNetworks is a test helper function that starts an instance with the given networks, and a plausible but invalid configuration, and returns the result of Environ.StartInstance.
func StartInstanceWithParams ¶
func StartInstanceWithParams( env environs.Environ, machineId string, params environs.StartInstanceParams, networks []string, ) ( *environs.StartInstanceResult, error, )
StartInstanceWithParams is a test helper function that starts an instance with the given parameters, and a plausible but invalid configuration, and returns the result of Environ.StartInstance. The provided params's MachineConfig and Tools field values will be ignored.
Types ¶
type JujuConnSuite ¶
type JujuConnSuite struct { // TODO: JujuConnSuite should not be concerned both with JUJU_HOME and with // /var/lib/juju: the use cases are completely non-overlapping, and any tests that // really do need both to exist ought to be embedding distinct fixtures for the // distinct environments. gitjujutesting.MgoSuite testing.FakeJujuHomeSuite envtesting.ToolsFixture DefaultToolsStorageDir string DefaultToolsStorage storage.Storage State *state.State Environ environs.Environ APIState *api.State ConfigStore configstore.Storage BackingState *state.State // The State being used by the API server RootDir string // The faked-up root directory. LogDir string DummyConfig testing.Attrs Factory *factory.Factory // contains filtered or unexported fields }
JujuConnSuite provides a freshly bootstrapped juju.Conn for each test. It also includes testing.BaseSuite.
It also sets up RootDir to point to a directory hierarchy mirroring the intended juju directory structure, including the following:
RootDir/home/ubuntu/.juju/environments.yaml The dummy environments.yaml file, holding a default environment named "dummyenv" which uses the "dummy" environment type. RootDir/var/lib/juju An empty directory returned as DataDir - the root of the juju data storage space.
$HOME is set to point to RootDir/home/ubuntu.
func (*JujuConnSuite) AddDefaultToolsToState ¶
func (s *JujuConnSuite) AddDefaultToolsToState(c *gc.C)
AddDefaultToolsToState adds tools to tools storage for {Number: version.Current.Number, Arch: amd64}, for the "precise" series and the environment's preferred series. The preferred series is default-series if specified, otherwise the latest LTS.
func (*JujuConnSuite) AddTestingCharm ¶
func (*JujuConnSuite) AddTestingService ¶
func (*JujuConnSuite) AddTestingServiceWithNetworks ¶
func (*JujuConnSuite) AddTestingServiceWithStorage ¶
func (*JujuConnSuite) AddToolsToState ¶
func (s *JujuConnSuite) AddToolsToState(c *gc.C, versions ...version.Binary)
AddToolsToState adds tools to tools storage.
func (*JujuConnSuite) AdminUserTag ¶
func (s *JujuConnSuite) AdminUserTag(c *gc.C) names.UserTag
func (*JujuConnSuite) AgentConfigForTag ¶
func (s *JujuConnSuite) AgentConfigForTag(c *gc.C, tag names.Tag) agent.ConfigSetter
func (*JujuConnSuite) AssertConfigParameterUpdated ¶
func (s *JujuConnSuite) AssertConfigParameterUpdated(c *gc.C, key string, value interface{})
AssertConfigParameterUpdated updates environment parameter and asserts that no errors were encountered
func (*JujuConnSuite) DataDir ¶
func (s *JujuConnSuite) DataDir() string
func (*JujuConnSuite) OpenAPIAs ¶
OpenAPIAs opens the API using the given identity tag and password for authentication. The returned *api.State should not be closed by the caller as a cleanup function has been registered to do that.
func (*JujuConnSuite) OpenAPIAsMachine ¶
OpenAPIAsMachine opens the API using the given machine tag, password and nonce for authentication. The returned *api.State should not be closed by the caller as a cleanup function has been registered to do that.
func (*JujuConnSuite) OpenAPIAsNewMachine ¶
func (s *JujuConnSuite) OpenAPIAsNewMachine(c *gc.C, jobs ...state.MachineJob) (*api.State, *state.Machine)
OpenAPIAsNewMachine creates a new machine entry that lives in system state, and then uses that to open the API. The returned *api.State should not be closed by the caller as a cleanup function has been registered to do that. The machine will run the supplied jobs; if none are given, JobHostUnits is assumed.
func (*JujuConnSuite) Reset ¶
func (s *JujuConnSuite) Reset(c *gc.C)
Reset returns environment state to that which existed at the start of the test.
func (*JujuConnSuite) SetUpSuite ¶
func (s *JujuConnSuite) SetUpSuite(c *gc.C)
func (*JujuConnSuite) SetUpTest ¶
func (s *JujuConnSuite) SetUpTest(c *gc.C)
func (*JujuConnSuite) TearDownSuite ¶
func (s *JujuConnSuite) TearDownSuite(c *gc.C)
func (*JujuConnSuite) TearDownTest ¶
func (s *JujuConnSuite) TearDownTest(c *gc.C)
func (*JujuConnSuite) WriteConfig ¶
func (s *JujuConnSuite) WriteConfig(configData string)
WriteConfig writes a juju config file to the "home" directory.
type RepoSuite ¶
type RepoSuite struct { JujuConnSuite SeriesPath string RepoPath string }
RepoSuite acts as a JujuConnSuite but also sets up $JUJU_REPOSITORY to point to a local charm repository.