testing

package
v0.0.0-...-9d6b0cf Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2013 License: AGPL-3.0, AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const AdminSecret = "dummy-secret"

Variables

This section is empty.

Functions

func FakeAPIInfo

func FakeAPIInfo(machineId string) *api.Info

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

func FakeStateInfo(machineId string) *state.Info

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 StartInstance

func StartInstance(c *C, env environs.Environ, machineId string) (instance.Instance, *instance.HardwareCharacteristics)

StartInstance is a test helper function that starts an instance on the environment using the current series and invalid info states.

func StartInstanceWithConstraints

func StartInstanceWithConstraints(c *C, env environs.Environ, machineId string,
	cons constraints.Value) (instance.Instance, *instance.HardwareCharacteristics)

StartInstanceWithConstraints is a test helper function that starts an instance on the environment with the specified constraints, using the current series and invalid info states.

Types

type GetStater

type GetStater interface {
	GetStateInAPIServer() *state.State
}

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.
	testing.LoggingSuite
	testing.MgoSuite
	Conn         *juju.Conn
	State        *state.State
	APIConn      *juju.APIConn
	APIState     *api.State
	BackingState *state.State // The State being used by the API server
	RootDir      string       // The faked-up root directory.
	// contains filtered or unexported fields
}

JujuConnSuite provides a freshly bootstrapped juju.Conn for each test. It also includes testing.LoggingSuite.

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) APIInfo

func (s *JujuConnSuite) APIInfo(c *C) *api.Info

func (*JujuConnSuite) AddTestingCharm

func (s *JujuConnSuite) AddTestingCharm(c *C, name string) *state.Charm

func (*JujuConnSuite) DataDir

func (s *JujuConnSuite) DataDir() string

func (*JujuConnSuite) OpenAPIAs

func (s *JujuConnSuite) OpenAPIAs(c *C, tag, password string) *api.State

OpenAPIAs opens the API using the given identity tag and password for authentication.

func (*JujuConnSuite) OpenAPIAsMachine

func (s *JujuConnSuite) OpenAPIAsMachine(c *C, tag, password, nonce string) *api.State

OpenAPIAsMachine opens the API using the given machine tag, password and nonce for authentication.

func (*JujuConnSuite) Reset

func (s *JujuConnSuite) Reset(c *C)

Reset returns environment state to that which existed at the start of the test.

func (*JujuConnSuite) SetUpSuite

func (s *JujuConnSuite) SetUpSuite(c *C)

func (*JujuConnSuite) SetUpTest

func (s *JujuConnSuite) SetUpTest(c *C)

func (*JujuConnSuite) StateInfo

func (s *JujuConnSuite) StateInfo(c *C) *state.Info

func (*JujuConnSuite) TearDownSuite

func (s *JujuConnSuite) TearDownSuite(c *C)

func (*JujuConnSuite) TearDownTest

func (s *JujuConnSuite) TearDownTest(c *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.

func (*RepoSuite) AssertCharmUploaded

func (s *RepoSuite) AssertCharmUploaded(c *C, curl *charm.URL)

func (*RepoSuite) AssertService

func (s *RepoSuite) AssertService(c *C, name string, expectCurl *charm.URL, unitCount, relCount int) (*state.Service, []*state.Relation)

func (*RepoSuite) AssertUnitMachines

func (s *RepoSuite) AssertUnitMachines(c *C, units []*state.Unit)

func (*RepoSuite) SetUpTest

func (s *RepoSuite) SetUpTest(c *C)

func (*RepoSuite) TearDownTest

func (s *RepoSuite) TearDownTest(c *C)

Jump to

Keyboard shortcuts

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