本文整理匯總了Golang中github.com/juju/juju/state.Living.Refresh方法的典型用法代碼示例。如果您正苦於以下問題:Golang Living.Refresh方法的具體用法?Golang Living.Refresh怎麽用?Golang Living.Refresh使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/juju/juju/state.Living
的用法示例。
在下文中一共展示了Living.Refresh方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: assertRemoved
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)
}
}
示例2: prepareFixture
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)
}
示例3: assertLife
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)
}
示例4: assertLife
func assertLife(c *gc.C, entity state.Living, life state.Life) {
c.Assert(entity.Refresh(), gc.IsNil)
c.Assert(entity.Life(), gc.Equals, life)
}
示例5: assertRemoved
func assertRemoved(c *gc.C, entity state.Living) {
err := entity.Refresh()
c.Assert(err, jc.Satisfies, errors.IsNotFound)
}