func (s *LifeSuite) prepareFixture(living state.Living, lfix lifeFixture, cached, dbinitial state.Life, c *gc.C) { collName, id := lfix.id() coll := s.MgoSuite.Session.DB("juju").C(collName) err := coll.UpdateId(id, bson.D{{"$set", bson.D{ {"life", cached}, }}}) c.Assert(err, jc.ErrorIsNil) err = living.Refresh() c.Assert(err, jc.ErrorIsNil) err = coll.UpdateId(id, bson.D{{"$set", bson.D{ {"life", dbinitial}, }}}) c.Assert(err, jc.ErrorIsNil) }
func assertRemoved(c *gc.C, entity state.Living) { err := entity.Refresh() c.Assert(err, jc.Satisfies, errors.IsNotFound) err = entity.Destroy() c.Assert(err, jc.ErrorIsNil) if entity, ok := entity.(state.AgentLiving); ok { err = entity.EnsureDead() c.Assert(err, jc.ErrorIsNil) err = entity.Remove() c.Assert(err, jc.ErrorIsNil) } }
func assertLife(c *gc.C, entity state.Living, life state.Life) { err := entity.Refresh() c.Assert(err, jc.ErrorIsNil) c.Assert(entity.Life(), gc.Equals, life) }
func assertLife(c *gc.C, entity state.Living, life state.Life) { c.Assert(entity.Refresh(), gc.IsNil) c.Assert(entity.Life(), gc.Equals, life) }
func assertRemoved(c *gc.C, entity state.Living) { err := entity.Refresh() c.Assert(err, jc.Satisfies, errors.IsNotFound) }