func removeServiceAndUnits(c *C, service *state.Service) { // Destroy all units for the service. units, err := service.AllUnits() c.Assert(err, IsNil) for _, unit := range units { err = unit.EnsureDead() c.Assert(err, IsNil) err = unit.Remove() c.Assert(err, IsNil) } err = service.Destroy() c.Assert(err, IsNil) err = service.Refresh() c.Assert(err, checkers.Satisfies, errors.IsNotFoundError) }