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) } }