本文整理汇总了Golang中github.com/juju/juju/state.State.ProcessDyingModel方法的典型用法代码示例。如果您正苦于以下问题:Golang State.ProcessDyingModel方法的具体用法?Golang State.ProcessDyingModel怎么用?Golang State.ProcessDyingModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/juju/state.State
的用法示例。
在下文中一共展示了State.ProcessDyingModel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: assertDyingEnvironTransitionDyingToDead
func (s *ModelSuite) assertDyingEnvironTransitionDyingToDead(c *gc.C, st *state.State) {
// Add a service to prevent the model from transitioning directly to Dead.
// Add the service before getting the Model, otherwise we'll have to run
// the transaction twice, and hit the hook point too early.
svc := factory.NewFactory(st).MakeService(c, nil)
env, err := st.Model()
c.Assert(err, jc.ErrorIsNil)
// ProcessDyingModel is called by a worker after Destroy is called. To
// avoid a race, we jump the gun here and test immediately after the
// environement was set to dead.
defer state.SetAfterHooks(c, st, func() {
c.Assert(env.Refresh(), jc.ErrorIsNil)
c.Assert(env.Life(), gc.Equals, state.Dying)
err := svc.Destroy()
c.Assert(err, jc.ErrorIsNil)
c.Assert(st.ProcessDyingModel(), jc.ErrorIsNil)
c.Assert(env.Refresh(), jc.ErrorIsNil)
c.Assert(env.Life(), gc.Equals, state.Dead)
}).Check()
c.Assert(env.Destroy(), jc.ErrorIsNil)
}
示例2: assertDyingEnvironTransitionDyingToDead
func (s *ModelSuite) assertDyingEnvironTransitionDyingToDead(c *gc.C, st *state.State) {
env, err := st.Model()
c.Assert(err, jc.ErrorIsNil)
// ProcessDyingModel is called by a worker after Destroy is called. To
// avoid a race, we jump the gun here and test immediately after the
// environement was set to dead.
defer state.SetAfterHooks(c, st, func() {
c.Assert(env.Refresh(), jc.ErrorIsNil)
c.Assert(env.Life(), gc.Equals, state.Dying)
c.Assert(st.ProcessDyingModel(), jc.ErrorIsNil)
c.Assert(env.Refresh(), jc.ErrorIsNil)
c.Assert(env.Life(), gc.Equals, state.Dead)
}).Check()
c.Assert(env.Destroy(), jc.ErrorIsNil)
}