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, policy state.Policy) *state.State
- func NewDialOpts() mongo.DialOpts
- func NewMongoInfo() *mongo.MongoInfo
- func NewState(c *gc.C) *state.State
- func SetAgentVersion(st *state.State, vers version.Number) error
- type KillWaiter
- type MapStorage
- type MockPolicy
- func (p *MockPolicy) ConfigValidator(providerType string) (state.ConfigValidator, error)
- func (p *MockPolicy) ConstraintsValidator(cfg *config.Config) (constraints.Validator, error)
- func (p *MockPolicy) EnvironCapability(cfg *config.Config) (state.EnvironCapability, error)
- func (p *MockPolicy) InstanceDistributor(cfg *config.Config) (state.InstanceDistributor, error)
- func (p *MockPolicy) Prechecker(cfg *config.Config) (state.Prechecker, error)
- type NotifyWatcher
- type NotifyWatcherC
- type RelationUnitsWatcher
- type RelationUnitsWatcherC
- type StateSuite
- 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 ¶
Initialize initializes the state and returns it. If state was not already initialized, and cfg is nil, the minimal default environment configuration will be used.
func NewDialOpts ¶
NewDialOpts returns configuration parameters for connecting to the testing state server.
func NewMongoInfo ¶
NewMongoInfo returns information suitable for connecting to the testing state server's mongo database.
func SetAgentVersion ¶
SetAgentVersion sets the current agent version in the state's environment configuration. This is similar to state.SetEnvironAgentVersion but it doesn't require that the environment have all agents at the same version already.
Types ¶
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 MockPolicy ¶
type MockPolicy struct { GetPrechecker func(*config.Config) (state.Prechecker, error) GetConfigValidator func(string) (state.ConfigValidator, error) GetEnvironCapability func(*config.Config) (state.EnvironCapability, error) GetConstraintsValidator func(*config.Config) (constraints.Validator, error) GetInstanceDistributor func(*config.Config) (state.InstanceDistributor, error) }
func (*MockPolicy) ConfigValidator ¶
func (p *MockPolicy) ConfigValidator(providerType string) (state.ConfigValidator, error)
func (*MockPolicy) ConstraintsValidator ¶
func (p *MockPolicy) ConstraintsValidator(cfg *config.Config) (constraints.Validator, error)
func (*MockPolicy) EnvironCapability ¶
func (p *MockPolicy) EnvironCapability(cfg *config.Config) (state.EnvironCapability, error)
func (*MockPolicy) InstanceDistributor ¶
func (p *MockPolicy) InstanceDistributor(cfg *config.Config) (state.InstanceDistributor, error)
func (*MockPolicy) Prechecker ¶
func (p *MockPolicy) Prechecker(cfg *config.Config) (state.Prechecker, 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 multiwatcher.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 Policy state.Policy State *state.State Owner names.UserTag Factory *factory.Factory }
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 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.