func (s *MinUnitsSuite) TestEnsureMinUnitsAddUnitsRetry(c *gc.C) { err := s.service.SetMinUnits(3) c.Assert(err, gc.IsNil) defer state.SetRetryHooks(c, s.State, func() { s.addUnits(c, 2) }, func() { assertAllUnits(c, s.service, 3) }).Check() err = s.service.EnsureMinUnits() c.Assert(err, gc.IsNil) }
func (s *MinUnitsSuite) TestMinUnitsInsertRetry(c *gc.C) { defer state.SetRetryHooks(c, s.State, func() { err := s.service.SetMinUnits(41) c.Assert(err, gc.IsNil) s.assertRevno(c, 0, nil) }, func() { s.assertRevno(c, 1, nil) }).Check() err := s.service.SetMinUnits(42) c.Assert(err, gc.IsNil) c.Assert(s.service.MinUnits(), gc.Equals, 42) }