Documentation
¶
Index ¶
- func ApplicationChange(c *gc.C, modelUUID string, app *state.Application) cache.ApplicationChange
- func ApplicationEvents(change interface{}) bool
- func BranchEvents(change interface{}) bool
- func CharmChange(modelUUID string, ch *state.Charm) cache.CharmChange
- func CharmEvents(change interface{}) bool
- func ControllerEvents(change interface{}) bool
- func MachineChange(c *gc.C, modelUUID string, machine *state.Machine) cache.MachineChange
- func MachineEvents(change interface{}) bool
- func ModelChange(c *gc.C, model *state.Model) cache.ModelChange
- func ModelChangeFromState(c *gc.C, st *state.State) cache.ModelChange
- func ModelEvents(change interface{}) bool
- func UnitChange(c *gc.C, modelUUID string, unit *state.Unit) cache.UnitChange
- func UnitEvents(change interface{}) bool
- type TestController
- func (tc *TestController) Init(c *gc.C, matchers ...func(interface{}) bool)
- func (tc *TestController) NextChange(c *gc.C) interface{}
- func (tc *TestController) SendChange(change interface{})
- func (tc *TestController) UpdateApplication(c *gc.C, modelUUID string, app *state.Application)
- func (tc *TestController) UpdateCharm(modelUUID string, ch *state.Charm)
- func (tc *TestController) UpdateMachine(c *gc.C, modelUUID string, machine *state.Machine)
- func (tc *TestController) UpdateModel(c *gc.C, m *state.Model)
- func (tc *TestController) UpdateUnit(c *gc.C, modelUUID string, unit *state.Unit)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplicationChange ¶
func ApplicationChange(c *gc.C, modelUUID string, app *state.Application) cache.ApplicationChange
ApplicationChange returns an ApplicationChange representing the input state application.
func ApplicationEvents ¶
func ApplicationEvents(change interface{}) bool
func BranchEvents ¶
func BranchEvents(change interface{}) bool
func CharmChange ¶
func CharmChange(modelUUID string, ch *state.Charm) cache.CharmChange
CharmChange returns a CharmChange representing the input state charm.
func CharmEvents ¶
func CharmEvents(change interface{}) bool
func ControllerEvents ¶
func ControllerEvents(change interface{}) bool
func MachineChange ¶
func MachineEvents ¶
func MachineEvents(change interface{}) bool
func ModelChange ¶
ModelChange returns a ModelChange representing the input state model.
func ModelChangeFromState ¶
ModelChangeFromState returns a ModelChange representing the current model for the state object.
func ModelEvents ¶
func ModelEvents(change interface{}) bool
func UnitChange ¶
UnitChange returns a UnitChange representing the input state unit.
func UnitEvents ¶
func UnitEvents(change interface{}) bool
Types ¶
type TestController ¶
type TestController struct { *cache.Controller // contains filtered or unexported fields }
TestController wraps a cache controller for testing. It allows synchronisation of state objects with the cache without the need for a multi-watcher and cache worker. This is useful when testing with StateSuite; JujuConnSuite sets up a cache worker and multiwatcher to keep the model cache in sync, so direct population using this technique is not necessary.
func NewTestController ¶
func NewTestController(matchers ...func(interface{}) bool) *TestController
NewTestController returns creates and returns a new test controller with an initial set of matchers for receiving cache event notifications. The controller can be instantiated like this in suite/test setups in order to retain a common set of matchers, but `Init` should be called in each test (see below).
func (*TestController) Init ¶
func (tc *TestController) Init(c *gc.C, matchers ...func(interface{}) bool)
Init instantiates the inner cache controller and sets up event synchronisation based on the input matchers. Changes sent to the cache can be waited on by using the `NextChange` method.
NOTE: It is recommended to perform this initialisation in the actual test method rather than `SetupSuite` or `SetupTest` as different gc.C references are supplied to each of those methods.
func (*TestController) NextChange ¶
func (tc *TestController) NextChange(c *gc.C) interface{}
NextChange returns the next change processed by the cache that satisfies a matcher, or fails the test with a time-out.
func (*TestController) SendChange ¶
func (tc *TestController) SendChange(change interface{})
func (*TestController) UpdateApplication ¶
func (tc *TestController) UpdateApplication(c *gc.C, modelUUID string, app *state.Application)
UpdateApplication updates the input state application in the cache.
func (*TestController) UpdateCharm ¶
func (tc *TestController) UpdateCharm(modelUUID string, ch *state.Charm)
UpdateCharm updates the input state charm in the cache.
func (*TestController) UpdateMachine ¶
UpdateMachine updates the input state machine in the cache.
func (*TestController) UpdateModel ¶
func (tc *TestController) UpdateModel(c *gc.C, m *state.Model)
UpdateModel updates the current model for the input state in the cache.
func (*TestController) UpdateUnit ¶
UpdateUnit updates the input state unit in the cache.