Documentation ¶
Index ¶
- Constants
- Variables
- func AlreadyExistsError(what string) *params.Error
- func AssertNotImplemented(c *gc.C, apiFacade interface{}, methodName string)
- func AssertPrincipalServiceDeployed(c *gc.C, st *state.State, serviceName string, curl *charm.URL, forced bool, ...) *state.Service
- func CheckMethodCalls(c *gc.C, stub *testing.Stub, calls ...StubMethodCall)
- func NotAssignedError(unitName string) *params.Error
- func NotFoundError(prefixMessage string) *params.Error
- func NotProvisionedError(machineId string) *params.Error
- func PrefixedError(prefix, message string) *params.Error
- func ResetStub(stub *testing.Stub)
- func ServerError(message string) *params.Error
- type CharmStoreSuite
- type FakeAuthorizer
- type FakeNotifyWatcher
- type FakeSpace
- type FakeSubnet
- func (f *FakeSubnet) AvailabilityZones() []string
- func (f *FakeSubnet) CIDR() string
- func (f *FakeSubnet) GoString() string
- func (f *FakeSubnet) Life() params.Life
- func (f *FakeSubnet) ProviderId() network.Id
- func (f *FakeSubnet) SpaceName() string
- func (f *FakeSubnet) Status() string
- func (f *FakeSubnet) VLANTag() int
- type FakeZone
- type SetUpFlag
- type StubBacking
- func (sb *StubBacking) AddSpace(name string, providerId network.Id, subnets []string, public bool) error
- func (sb *StubBacking) AddSubnet(subnetInfo networkingcommon.BackingSubnetInfo) (networkingcommon.BackingSubnet, error)
- func (sb *StubBacking) AllSpaces() ([]networkingcommon.BackingSpace, error)
- func (sb *StubBacking) AllSubnets() ([]networkingcommon.BackingSubnet, error)
- func (sb *StubBacking) AvailabilityZones() ([]providercommon.AvailabilityZone, error)
- func (se *StubBacking) GoString() string
- func (sb *StubBacking) ModelConfig() (*config.Config, error)
- func (sb *StubBacking) SetAvailabilityZones(zones []providercommon.AvailabilityZone) error
- func (sb *StubBacking) SetUp(c *gc.C, envName string, withZones, withSpaces, withSubnets SetUpFlag)
- type StubEnviron
- type StubMethodCall
- func BackingCall(name string, args ...interface{}) StubMethodCall
- func EnvironCall(name string, args ...interface{}) StubMethodCall
- func NetworkingEnvironCall(name string, args ...interface{}) StubMethodCall
- func ProviderCall(name string, args ...interface{}) StubMethodCall
- func ZonedEnvironCall(name string, args ...interface{}) StubMethodCall
- func ZonedNetworkingEnvironCall(name string, args ...interface{}) StubMethodCall
- type StubNetwork
- type StubNetworkingEnviron
- type StubProvider
- type StubZonedEnviron
- type StubZonedNetworkingEnviron
- func (se *StubZonedNetworkingEnviron) AvailabilityZones() ([]providercommon.AvailabilityZone, error)
- func (se *StubZonedNetworkingEnviron) GoString() string
- func (se *StubZonedNetworkingEnviron) Subnets(instId instance.Id, subIds []network.Id) ([]network.SubnetInfo, error)
- func (se *StubZonedNetworkingEnviron) SupportsSpaces() (bool, error)
Constants ¶
const ( StubProviderType = "stub-provider" StubEnvironName = "stub-environ" StubZonedEnvironName = "stub-zoned-environ" StubNetworkingEnvironName = "stub-networking-environ" StubZonedNetworkingEnvironName = "stub-zoned-networking-environ" )
Variables ¶
var ( testing.Stub{} BackingInstance = &StubBacking{Stub: SharedStub} ProviderInstance = &StubProvider{Stub: SharedStub} EnvironInstance = &StubEnviron{Stub: SharedStub} ZonedEnvironInstance = &StubZonedEnviron{Stub: SharedStub} NetworkingEnvironInstance = &StubNetworkingEnviron{Stub: SharedStub} ZonedNetworkingEnvironInstance = &StubZonedNetworkingEnviron{Stub: SharedStub} )SharedStub = &
params.CodeUnauthorized, }Message: "permission denied", Code:
Functions ¶
func AlreadyExistsError ¶
func AssertNotImplemented ¶
func CheckMethodCalls ¶
func CheckMethodCalls(c *gc.C, stub *testing.Stub, calls ...StubMethodCall)
CheckMethodCalls works like testing.Stub.CheckCalls, but also checks the receivers.
func NotAssignedError ¶
func NotFoundError ¶
func NotProvisionedError ¶
func PrefixedError ¶
func ServerError ¶
Types ¶
type CharmStoreSuite ¶
type CharmStoreSuite struct { testing.CleanupSuite Session *mgo.Session // DischargeUser holds the identity of the user // that the 3rd party caveat discharger will issue // macaroons for. If it is empty, no caveats will be discharged. DischargeUser string Srv *httptest.Server Client *csclient.Client // contains filtered or unexported fields }
func (*CharmStoreSuite) SetUpTest ¶
func (s *CharmStoreSuite) SetUpTest(c *gc.C)
func (*CharmStoreSuite) TearDownTest ¶
func (s *CharmStoreSuite) TearDownTest(c *gc.C)
func (*CharmStoreSuite) UploadCharm ¶
func (s *CharmStoreSuite) UploadCharm(c *gc.C, url, name string) (*charm.URL, charm.Charm)
func (*CharmStoreSuite) UploadCharmMultiSeries ¶
func (s *CharmStoreSuite) UploadCharmMultiSeries(c *gc.C, url, name string) (*charm.URL, charm.Charm)
type FakeAuthorizer ¶
FakeAuthorizer implements the common.Authorizer interface.
func (FakeAuthorizer) AuthClient ¶
func (fa FakeAuthorizer) AuthClient() bool
AuthClient returns whether the authenticated entity is a client user.
func (FakeAuthorizer) AuthMachineAgent ¶
func (fa FakeAuthorizer) AuthMachineAgent() bool
AuthMachineAgent returns whether the current client is a machine agent.
func (FakeAuthorizer) AuthModelManager ¶
func (fa FakeAuthorizer) AuthModelManager() bool
func (FakeAuthorizer) AuthUnitAgent ¶
func (fa FakeAuthorizer) AuthUnitAgent() bool
AuthUnitAgent returns whether the current client is a unit agent.
func (FakeAuthorizer) GetAuthTag ¶
func (fa FakeAuthorizer) GetAuthTag() names.Tag
type FakeNotifyWatcher ¶
type FakeNotifyWatcher struct { C chan struct{} // contains filtered or unexported fields }
FakeNotifyWatcher is an implementation of state.NotifyWatcher which is useful in tests.
func NewFakeNotifyWatcher ¶
func NewFakeNotifyWatcher() *FakeNotifyWatcher
func (*FakeNotifyWatcher) Changes ¶
func (w *FakeNotifyWatcher) Changes() <-chan struct{}
func (*FakeNotifyWatcher) Err ¶
func (w *FakeNotifyWatcher) Err() error
func (*FakeNotifyWatcher) Kill ¶
func (w *FakeNotifyWatcher) Kill()
func (*FakeNotifyWatcher) Stop ¶
func (w *FakeNotifyWatcher) Stop() error
func (*FakeNotifyWatcher) Wait ¶
func (w *FakeNotifyWatcher) Wait() error
type FakeSpace ¶
FakeSpace implements networkingcommon.BackingSpace for testing.
func (*FakeSpace) ProviderId ¶
func (*FakeSpace) Subnets ¶
func (f *FakeSpace) Subnets() (bs []networkingcommon.BackingSubnet, err error)
type FakeSubnet ¶
type FakeSubnet struct {
// contains filtered or unexported fields
}
FakeSubnet implements networkingcommon.BackingSubnet for testing.
func (*FakeSubnet) AvailabilityZones ¶
func (f *FakeSubnet) AvailabilityZones() []string
func (*FakeSubnet) CIDR ¶
func (f *FakeSubnet) CIDR() string
func (*FakeSubnet) GoString ¶
func (f *FakeSubnet) GoString() string
GoString implements fmt.GoStringer.
func (*FakeSubnet) Life ¶
func (f *FakeSubnet) Life() params.Life
func (*FakeSubnet) ProviderId ¶
func (f *FakeSubnet) ProviderId() network.Id
func (*FakeSubnet) SpaceName ¶
func (f *FakeSubnet) SpaceName() string
func (*FakeSubnet) Status ¶
func (f *FakeSubnet) Status() string
func (*FakeSubnet) VLANTag ¶
func (f *FakeSubnet) VLANTag() int
type FakeZone ¶
FakeZone implements providercommon.AvailabilityZone for testing.
type StubBacking ¶
type StubBacking struct { *testing.Stub EnvConfig *config.Config Zones []providercommon.AvailabilityZone Spaces []networkingcommon.BackingSpace Subnets []networkingcommon.BackingSubnet }
StubBacking implements networkingcommon.NetworkBacking and records calls to its methods.
func (*StubBacking) AddSubnet ¶
func (sb *StubBacking) AddSubnet(subnetInfo networkingcommon.BackingSubnetInfo) (networkingcommon.BackingSubnet, error)
func (*StubBacking) AllSpaces ¶
func (sb *StubBacking) AllSpaces() ([]networkingcommon.BackingSpace, error)
func (*StubBacking) AllSubnets ¶
func (sb *StubBacking) AllSubnets() ([]networkingcommon.BackingSubnet, error)
func (*StubBacking) AvailabilityZones ¶
func (sb *StubBacking) AvailabilityZones() ([]providercommon.AvailabilityZone, error)
func (*StubBacking) GoString ¶
func (se *StubBacking) GoString() string
GoString implements fmt.GoStringer.
func (*StubBacking) ModelConfig ¶
func (sb *StubBacking) ModelConfig() (*config.Config, error)
func (*StubBacking) SetAvailabilityZones ¶
func (sb *StubBacking) SetAvailabilityZones(zones []providercommon.AvailabilityZone) error
type StubEnviron ¶
type StubEnviron struct { *testing.Stub environs.Environ // panic on any not implemented method call }
StubEnviron is used in tests where environs.Environ is needed.
func (*StubEnviron) GoString ¶
func (se *StubEnviron) GoString() string
GoString implements fmt.GoStringer.
type StubMethodCall ¶
type StubMethodCall struct { Receiver interface{} FuncName string Args []interface{} }
StubMethodCall is like testing.StubCall, but includes the receiver as well.
func BackingCall ¶
func BackingCall(name string, args ...interface{}) StubMethodCall
BackingCall makes it easy to check method calls on BackingInstance.
func EnvironCall ¶
func EnvironCall(name string, args ...interface{}) StubMethodCall
EnvironCall makes it easy to check method calls on EnvironInstance.
func NetworkingEnvironCall ¶
func NetworkingEnvironCall(name string, args ...interface{}) StubMethodCall
NetworkingEnvironCall makes it easy to check method calls on NetworkingEnvironInstance.
func ProviderCall ¶
func ProviderCall(name string, args ...interface{}) StubMethodCall
ProviderCall makes it easy to check method calls on ProviderInstance.
func ZonedEnvironCall ¶
func ZonedEnvironCall(name string, args ...interface{}) StubMethodCall
ZonedEnvironCall makes it easy to check method calls on ZonedEnvironInstance.
func ZonedNetworkingEnvironCall ¶
func ZonedNetworkingEnvironCall(name string, args ...interface{}) StubMethodCall
ZonedNetworkingEnvironCall makes it easy to check method calls on ZonedNetworkingEnvironInstance.
type StubNetwork ¶
type StubNetwork struct { }
func (StubNetwork) SetUpSuite ¶
func (s StubNetwork) SetUpSuite(c *gc.C)
type StubNetworkingEnviron ¶
type StubNetworkingEnviron struct { *testing.Stub environs.NetworkingEnviron // panic on any not implemented method call }
StubNetworkingEnviron is used in tests where environs.NetworkingEnviron is needed.
func (*StubNetworkingEnviron) GoString ¶
func (se *StubNetworkingEnviron) GoString() string
GoString implements fmt.GoStringer.
func (*StubNetworkingEnviron) Subnets ¶
func (se *StubNetworkingEnviron) Subnets(instId instance.Id, subIds []network.Id) ([]network.SubnetInfo, error)
func (*StubNetworkingEnviron) SupportsSpaces ¶
func (se *StubNetworkingEnviron) SupportsSpaces() (bool, error)
type StubProvider ¶
type StubProvider struct { *testing.Stub Zones []providercommon.AvailabilityZone Subnets []network.SubnetInfo environs.EnvironProvider // panic on any not implemented method call. }
StubProvider implements a subset of environs.EnvironProvider methods used in tests.
func (*StubProvider) GoString ¶
func (se *StubProvider) GoString() string
GoString implements fmt.GoStringer.
type StubZonedEnviron ¶
type StubZonedEnviron struct { *testing.Stub providercommon.ZonedEnviron // panic on any not implemented method call }
StubZonedEnviron is used in tests where providercommon.ZonedEnviron is needed.
func (*StubZonedEnviron) AvailabilityZones ¶
func (se *StubZonedEnviron) AvailabilityZones() ([]providercommon.AvailabilityZone, error)
func (*StubZonedEnviron) GoString ¶
func (se *StubZonedEnviron) GoString() string
GoString implements fmt.GoStringer.
type StubZonedNetworkingEnviron ¶
type StubZonedNetworkingEnviron struct { *testing.Stub // panic on any not implemented method call providercommon.ZonedEnviron environs.Networking }
StubZonedNetworkingEnviron is used in tests where features from both environs.Networking and providercommon.ZonedEnviron are needed.
func (*StubZonedNetworkingEnviron) AvailabilityZones ¶
func (se *StubZonedNetworkingEnviron) AvailabilityZones() ([]providercommon.AvailabilityZone, error)
func (*StubZonedNetworkingEnviron) GoString ¶
func (se *StubZonedNetworkingEnviron) GoString() string
GoString implements fmt.GoStringer.
func (*StubZonedNetworkingEnviron) Subnets ¶
func (se *StubZonedNetworkingEnviron) Subnets(instId instance.Id, subIds []network.Id) ([]network.SubnetInfo, error)
func (*StubZonedNetworkingEnviron) SupportsSpaces ¶
func (se *StubZonedNetworkingEnviron) SupportsSpaces() (bool, error)