Documentation ¶
Index ¶
- func AssertCanStopWhenSending(c *gc.C, stopper Stopper)
- func AssertKillAndWait(c *gc.C, killWaiter KillWaiter)
- func AssertStop(c *gc.C, stopper Stopper)
- func Initialize(c *gc.C, owner names.UserTag, cfg *config.Config, ...) *state.State
- func InitializeWithArgs(c *gc.C, args InitializeArgs) *state.State
- func NewMongoInfo() *mongo.MongoInfo
- func NewState(c *gc.C) *state.State
- func SetAgentVersion(st *state.State, vers version.Number) error
- type InitializeArgs
- type KillWaiter
- type MapStorage
- type MockConfigSchemaSource
- type MockPolicy
- func (p *MockPolicy) ConfigValidator() (config.Validator, error)
- func (p *MockPolicy) ConstraintsValidator() (constraints.Validator, error)
- func (p *MockPolicy) InstanceDistributor() (instance.Distributor, error)
- func (p *MockPolicy) Prechecker() (state.Prechecker, error)
- func (p *MockPolicy) ProviderConfigSchemaSource() (config.ConfigSchemaSource, error)
- func (p *MockPolicy) StorageProviderRegistry() (storage.ProviderRegistry, error)
- type NotifyWatcher
- type NotifyWatcherC
- type RelationUnitsWatcher
- type RelationUnitsWatcherC
- type StateSuite
- type StateWithWallClockSuite
- type Stopper
- type StringsWatcher
- type StringsWatcherC
- func (c StringsWatcherC) AssertChange(expect ...string)
- func (c StringsWatcherC) AssertChangeInSingleEvent(expect ...string)
- func (c StringsWatcherC) AssertChangeMaybeIncluding(expect ...string)
- func (c StringsWatcherC) AssertChanges()
- func (c StringsWatcherC) AssertClosed()
- func (c StringsWatcherC) AssertNoChange()
- type SyncStarter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertCanStopWhenSending ¶
AssertCanStopWhenSending ensures even when there are changes pending to be delivered by the watcher it can still stop cleanly. This is necessary to check for deadlocks in case the watcher's inner loop is blocked trying to send and its tomb is already dying.
func AssertKillAndWait ¶
func AssertKillAndWait(c *gc.C, killWaiter KillWaiter)
func AssertStop ¶
func Initialize ¶
func Initialize(c *gc.C, owner names.UserTag, cfg *config.Config, controllerInheritedConfig map[string]interface{}, regionConfig cloud.RegionConfig, newPolicy state.NewPolicyFunc) *state.State
Initialize initializes the state and returns it. If state was not already initialized, and cfg is nil, the minimal default model configuration will be used. This provides for tests still using a real clock from utils as tests are migrated to use the testing clock
func InitializeWithArgs ¶
func InitializeWithArgs(c *gc.C, args InitializeArgs) *state.State
InitializeWithArgs initializes the state and returns it. If state was not already initialized, and args.Config is nil, the minimal default model configuration will be used.
func NewMongoInfo ¶
NewMongoInfo returns information suitable for connecting to the testing controller's mongo database.
Types ¶
type InitializeArgs ¶
type InitializeArgs struct { Owner names.UserTag InitialConfig *config.Config ControllerInheritedConfig map[string]interface{} RegionConfig cloud.RegionConfig NewPolicy state.NewPolicyFunc Clock clock.Clock }
type KillWaiter ¶
type KillWaiter interface { Kill() Wait() error }
type MapStorage ¶
func (*MapStorage) Get ¶
func (s *MapStorage) Get(path string) (r io.ReadCloser, length int64, err error)
func (*MapStorage) Remove ¶
func (s *MapStorage) Remove(path string) error
type MockConfigSchemaSource ¶
type MockConfigSchemaSource struct{}
func (*MockConfigSchemaSource) ConfigDefaults ¶
func (m *MockConfigSchemaSource) ConfigDefaults() schema.Defaults
func (*MockConfigSchemaSource) ConfigSchema ¶
func (m *MockConfigSchemaSource) ConfigSchema() schema.Fields
type MockPolicy ¶
type MockPolicy struct { GetPrechecker func() (state.Prechecker, error) GetConfigValidator func() (config.Validator, error) GetProviderConfigSchemaSource func() (config.ConfigSchemaSource, error) GetConstraintsValidator func() (constraints.Validator, error) GetInstanceDistributor func() (instance.Distributor, error) GetStorageProviderRegistry func() (storage.ProviderRegistry, error) }
func (*MockPolicy) ConfigValidator ¶
func (p *MockPolicy) ConfigValidator() (config.Validator, error)
func (*MockPolicy) ConstraintsValidator ¶
func (p *MockPolicy) ConstraintsValidator() (constraints.Validator, error)
func (*MockPolicy) InstanceDistributor ¶
func (p *MockPolicy) InstanceDistributor() (instance.Distributor, error)
func (*MockPolicy) Prechecker ¶
func (p *MockPolicy) Prechecker() (state.Prechecker, error)
func (*MockPolicy) ProviderConfigSchemaSource ¶
func (p *MockPolicy) ProviderConfigSchemaSource() (config.ConfigSchemaSource, error)
func (*MockPolicy) StorageProviderRegistry ¶
func (p *MockPolicy) StorageProviderRegistry() (storage.ProviderRegistry, error)
type NotifyWatcher ¶
type NotifyWatcher interface { Stop() error Changes() <-chan struct{} }
type NotifyWatcherC ¶
type NotifyWatcherC struct { *gc.C State SyncStarter Watcher NotifyWatcher }
NotifyWatcherC embeds a gocheck.C and adds methods to help verify the behaviour of any watcher that uses a <-chan struct{}.
func NewNotifyWatcherC ¶
func NewNotifyWatcherC(c *gc.C, st SyncStarter, w NotifyWatcher) NotifyWatcherC
NewNotifyWatcherC returns a NotifyWatcherC that checks for aggressive event coalescence.
func (NotifyWatcherC) AssertClosed ¶
func (c NotifyWatcherC) AssertClosed()
func (NotifyWatcherC) AssertNoChange ¶
func (c NotifyWatcherC) AssertNoChange()
func (NotifyWatcherC) AssertOneChange ¶
func (c NotifyWatcherC) AssertOneChange()
type RelationUnitsWatcher ¶
type RelationUnitsWatcher interface { Stop() error Changes() <-chan params.RelationUnitsChange }
type RelationUnitsWatcherC ¶
type RelationUnitsWatcherC struct { *gc.C State SyncStarter Watcher RelationUnitsWatcher // contains filtered or unexported fields }
RelationUnitsWatcherC embeds a gocheck.C and adds methods to help verify the behaviour of any watcher that uses a <-chan params.RelationUnitsChange.
func NewRelationUnitsWatcherC ¶
func NewRelationUnitsWatcherC(c *gc.C, st SyncStarter, w RelationUnitsWatcher) RelationUnitsWatcherC
NewRelationUnitsWatcherC returns a RelationUnitsWatcherC that checks for aggressive event coalescence.
func (RelationUnitsWatcherC) AssertChange ¶
func (c RelationUnitsWatcherC) AssertChange(changed []string, departed []string)
AssertChange asserts the given changes was reported by the watcher, but does not assume there are no following changes.
func (RelationUnitsWatcherC) AssertClosed ¶
func (c RelationUnitsWatcherC) AssertClosed()
func (RelationUnitsWatcherC) AssertNoChange ¶
func (c RelationUnitsWatcherC) AssertNoChange()
type StateSuite ¶
type StateSuite struct { jujutesting.MgoSuite testing.BaseSuite NewPolicy state.NewPolicyFunc State *state.State Owner names.UserTag Factory *factory.Factory InitialConfig *config.Config ControllerInheritedConfig map[string]interface{} RegionConfig cloud.RegionConfig Clock *jujutesting.Clock }
StateSuite provides setup and teardown for tests that require a state.State.
func (*StateSuite) SetUpSuite ¶
func (s *StateSuite) SetUpSuite(c *gc.C)
func (*StateSuite) SetUpTest ¶
func (s *StateSuite) SetUpTest(c *gc.C)
func (*StateSuite) TearDownSuite ¶
func (s *StateSuite) TearDownSuite(c *gc.C)
func (*StateSuite) TearDownTest ¶
func (s *StateSuite) TearDownTest(c *gc.C)
type StateWithWallClockSuite ¶
type StateWithWallClockSuite struct { testing.MgoSuite coretesting.BaseSuite NewPolicy state.NewPolicyFunc State *state.State Owner names.UserTag Factory *factory.Factory InitialConfig *config.Config ControllerInheritedConfig map[string]interface{} RegionConfig cloud.RegionConfig }
StateWithWallClockSuite provides setup and teardown for tests that require a state.State. This should be deprecated in favour of StateSuite, and tests updated to use the testing clock StateSuite provides.
func (*StateWithWallClockSuite) SetUpSuite ¶
func (s *StateWithWallClockSuite) SetUpSuite(c *gc.C)
func (*StateWithWallClockSuite) SetUpTest ¶
func (s *StateWithWallClockSuite) SetUpTest(c *gc.C)
func (*StateWithWallClockSuite) TearDownSuite ¶
func (s *StateWithWallClockSuite) TearDownSuite(c *gc.C)
func (*StateWithWallClockSuite) TearDownTest ¶
func (s *StateWithWallClockSuite) TearDownTest(c *gc.C)
type StringsWatcher ¶
type StringsWatcherC ¶
type StringsWatcherC struct { *gc.C State SyncStarter Watcher StringsWatcher }
StringsWatcherC embeds a gocheck.C and adds methods to help verify the behaviour of any watcher that uses a <-chan []string.
func NewStringsWatcherC ¶
func NewStringsWatcherC(c *gc.C, st SyncStarter, w StringsWatcher) StringsWatcherC
NewStringsWatcherC returns a StringsWatcherC that checks for aggressive event coalescence.
func (StringsWatcherC) AssertChange ¶
func (c StringsWatcherC) AssertChange(expect ...string)
func (StringsWatcherC) AssertChangeInSingleEvent ¶
func (c StringsWatcherC) AssertChangeInSingleEvent(expect ...string)
func (StringsWatcherC) AssertChangeMaybeIncluding ¶
func (c StringsWatcherC) AssertChangeMaybeIncluding(expect ...string)
AssertChangeMaybeIncluding verifies that there is a change that may contain zero to all of the passed in strings, and no other changes.
func (StringsWatcherC) AssertChanges ¶
func (c StringsWatcherC) AssertChanges()
func (StringsWatcherC) AssertClosed ¶
func (c StringsWatcherC) AssertClosed()
func (StringsWatcherC) AssertNoChange ¶
func (c StringsWatcherC) AssertNoChange()
type SyncStarter ¶
type SyncStarter interface {
StartSync()
}
SyncStarter is an interface that watcher checkers will use to ensure that changes to the watched object have been synchronized. This is primarily implemented by state.State.