示例#1
0
func (s *LockerSuite) TestAvailable(c *gc.C) {
	resolver.UpdateCharmDir(operation.State{Started: true, Stopped: false}, s.locker)
	resolver.UpdateCharmDir(operation.State{Started: true, Stopped: false, Kind: operation.Continue}, s.locker)
	resolver.UpdateCharmDir(operation.State{Started: true, Stopped: false, Kind: operation.RunAction}, s.locker)
	resolver.UpdateCharmDir(operation.State{
		Started: true,
		Stopped: false,
		Kind:    operation.RunHook,
		Hook: &hook.Info{
			Kind: hooks.ConfigChanged,
		},
	}, s.locker)

	c.Assert(s.locker.Calls(), gc.HasLen, 4)
	for _, call := range s.locker.Calls() {
		c.Assert(call.Args, jc.SameContents, []interface{}{true})
	}
}
示例#2
0
func (s *GuardSuite) TestLockdownAbortArg(c *gc.C) {
	abort := make(fortress.Abort)
	err := resolver.UpdateCharmDir(operation.State{}, s.guard, abort)
	c.Assert(err, jc.ErrorIsNil)
	s.guard.CheckCalls(c, []testing.StubCall{{FuncName: "Lockdown", Args: []interface{}{abort}}})
}
示例#3
0
func (s *GuardSuite) checkCall(c *gc.C, state operation.State, call string) {
	err := resolver.UpdateCharmDir(state, s.guard, nil)
	c.Assert(err, jc.ErrorIsNil)
	s.guard.CheckCallNames(c, call)
}